Class VectorMath
VectorMath contains methods for performing
 scalar numeric operations in support of vector numeric operations.- Since:
- 24
- 
Method SummaryModifier and TypeMethodDescriptionstatic byteaddSaturating(byte a, byte b) Adds twobytevalues using saturation arithemetic.static intaddSaturating(int a, int b) Adds twointvalues using saturation arithemetic.static longaddSaturating(long a, long b) Adds twolongvalues using saturation arithemetic.static shortaddSaturating(short a, short b) Adds twoshortvalues using saturation arithemetic.static byteaddSaturatingUnsigned(byte a, byte b) Adds twobytevalues using saturation arithemetic and numerically treating the values as unsigned.static intaddSaturatingUnsigned(int a, int b) Adds twointvalues using saturation arithemetic and numerically treating the values as unsigned.static longaddSaturatingUnsigned(long a, long b) Adds twolongvalues using saturation arithemetic and numerically treating the values as unsigned.static shortaddSaturatingUnsigned(short a, short b) Adds twoshortvalues using saturation arithemetic and numerically treating the values as unsigned.static bytemaxUnsigned(byte a, byte b) Returns the greater of twobytevalues numerically treating the values as unsigned.static intmaxUnsigned(int a, int b) Returns the greater of twointvalues numerically treating the values as unsigned.static longmaxUnsigned(long a, long b) Returns the greater of twolongvalues numerically treating the values as unsigned.static shortmaxUnsigned(short a, short b) Returns the greater of twoshortvalues numerically treating the values as unsigned.static byteminUnsigned(byte a, byte b) Returns the smaller of twobytevalues numerically treating the values as unsigned.static intminUnsigned(int a, int b) Returns the smaller of twointvalues numerically treating the values as unsigned.static longminUnsigned(long a, long b) Returns the smaller of twolongvalues numerically treating the values as unsigned.static shortminUnsigned(short a, short b) Returns the smaller of twoshortvalues numerically treating the values as unsigned.static bytesubSaturating(byte a, byte b) Subtracts twobytevalues using saturation arithemetic.static intsubSaturating(int a, int b) Subtracts twointvalues using saturation arithemetic.static longsubSaturating(long a, long b) Subtracts twolongvalues using saturation arithemetic.static shortsubSaturating(short a, short b) Subtracts twoshortvalues using saturation arithemetic.static bytesubSaturatingUnsigned(byte a, byte b) Subtracts twobytevalues using saturation arithemetic and numerically treating the values as unsigned.static intsubSaturatingUnsigned(int a, int b) Subtracts twointvalues using saturation arithemetic and numerically treating the values as unsigned.static longsubSaturatingUnsigned(long a, long b) Subtracts twolongvalues using saturation arithemetic and numerically treating the values as unsigned.static shortsubSaturatingUnsigned(short a, short b) Subtracts twoshortvalues using saturation arithemetic and numerically treating the values as unsigned.
- 
Method Details- 
minUnsignedpublic static long minUnsigned(long a, long b) Returns the smaller of twolongvalues numerically treating the values as unsigned. That is, the result is the operand closer to the value of the expression0L. If the operands have the same value, the result is that same value.- Parameters:
- a- the first operand.
- b- the second operand.
- Returns:
- the smaller of aandb.
- See Also:
 
- 
maxUnsignedpublic static long maxUnsigned(long a, long b) Returns the greater of twolongvalues numerically treating the values as unsigned. That is, the result is the operand closer to the value of the expression0xFFFFFFFF_FFFFFFFFLnumerically treating it as unsigned. If the operands have the same value, the result is that same value.- Parameters:
- a- the first operand.
- b- the second operand.
- Returns:
- the larger of aandb.
- See Also:
 
- 
addSaturatingpublic static long addSaturating(long a, long b) Adds twolongvalues using saturation arithemetic. The lower and upper (inclusive) bounds areLong.MIN_VALUEandLong.MAX_VALUE, respectively.If the result of the addition would otherwise overflow from a positive value to a negative value then the result is clamped to the upper bound Long.MAX_VALUE. If the result of the addition would otherwise underflow from a negative value to a positive value then the result is clamped to lower boundLong.MIN_VALUE.- Parameters:
- a- the first operand.
- b- the second operand.
- Returns:
- the saturating addition of the operands.
- See Also:
 
- 
subSaturatingpublic static long subSaturating(long a, long b) Subtracts twolongvalues using saturation arithemetic. The lower and upper (inclusive) bounds areLong.MIN_VALUEandLong.MAX_VALUE, respectively.If the result of the subtraction would otherwise overflow from a positive value to a negative value then the result is clamped to the upper bound Long.MAX_VALUE. If the result of the subtraction would otherwise underflow from a negative value to a positive value then the result is clamped to lower boundLong.MIN_VALUE.- Parameters:
- a- the first operand.
- b- the second operand.
- Returns:
- the saturating difference of the operands.
- See Also:
 
- 
addSaturatingUnsignedpublic static long addSaturatingUnsigned(long a, long b) Adds twolongvalues using saturation arithemetic and numerically treating the values as unsigned. The lower and upper (inclusive) bounds are0Land0xFFFFFFFF_FFFFFFFFL, respectively, numerically treating them as unsigned.If the result of the unsigned addition would otherwise overflow from the greater of the two operands to a lesser value then the result is clamped to the upper bound 0xFFFFFFFF_FFFFFFFFL.- Parameters:
- a- the first operand.
- b- the second operand.
- Returns:
- the saturating addition of the operands.
- See Also:
 
- 
subSaturatingUnsignedpublic static long subSaturatingUnsigned(long a, long b) Subtracts twolongvalues using saturation arithemetic and numerically treating the values as unsigned. The lower and upper (inclusive) bounds are0Land0xFFFFFFFF_FFFFFFFFL, respectively, numerically treating them as unsigned.If the result of the unsigned subtraction would otherwise underflow from the lesser of the two operands to a greater value then the result is clamped to the lower bound 0L.- Parameters:
- a- the first operand.
- b- the second operand.
- Returns:
- the saturating difference of the operands.
- See Also:
 
- 
minUnsignedpublic static int minUnsigned(int a, int b) Returns the smaller of twointvalues numerically treating the values as unsigned. That is, the result is the operand closer to the value of the expression0. If the operands have the same value, the result is that same value.- Parameters:
- a- the first operand.
- b- the second operand.
- Returns:
- the smaller of aandb.
- See Also:
 
- 
maxUnsignedpublic static int maxUnsigned(int a, int b) Returns the greater of twointvalues numerically treating the values as unsigned. That is, the result is the operand closer to the value of the expression0xFFFFFFFFnumerically treating it as unsigned. If the operands have the same value, the result is that same value.- Parameters:
- a- the first operand.
- b- the second operand.
- Returns:
- the larger of aandb.
- See Also:
 
- 
addSaturatingpublic static int addSaturating(int a, int b) Adds twointvalues using saturation arithemetic. The lower and upper (inclusive) bounds areInteger.MIN_VALUEandInteger.MAX_VALUE, respectively.If the result of the addition would otherwise overflow from a positive value to a negative value then the result is clamped to the upper bound Integer.MAX_VALUE. If the result of the addition would otherwise underflow from a negative value to a positive value then the result is clamped to lower boundInteger.MIN_VALUE.- Parameters:
- a- the first operand.
- b- the second operand.
- Returns:
- the saturating addition of the operands.
- See Also:
 
- 
subSaturatingpublic static int subSaturating(int a, int b) Subtracts twointvalues using saturation arithemetic. The lower and upper (inclusive) bounds areInteger.MIN_VALUEandInteger.MAX_VALUE, respectively.If the result of the subtraction would otherwise overflow from a positive value to a negative value then the result is clamped to the upper bound Integer.MAX_VALUE. If the result of the subtraction would otherwise underflow from a negative value to a positive value then the result is clamped to lower boundInteger.MIN_VALUE.- Parameters:
- a- the first operand.
- b- the second operand.
- Returns:
- the saturating difference of the operands.
- See Also:
 
- 
addSaturatingUnsignedpublic static int addSaturatingUnsigned(int a, int b) Adds twointvalues using saturation arithemetic and numerically treating the values as unsigned. The lower and upper (inclusive) bounds are0and0xFFFFFFFF, respectively, numerically treating them as unsigned.If the result of the unsigned addition would otherwise overflow from the greater of the two operands to a lesser value then the result is clamped to the upper bound 0xFFFFFFFF.- Parameters:
- a- the first operand.
- b- the second operand.
- Returns:
- the saturating addition of the operands.
- See Also:
 
- 
subSaturatingUnsignedpublic static int subSaturatingUnsigned(int a, int b) Subtracts twointvalues using saturation arithemetic and numerically treating the values as unsigned. The lower and upper (inclusive) bounds are0and-0xFFFFFFFF, respectively, numerically treating them as unsigned.If the result of the unsigned subtraction would otherwise underflow from the lesser of the two operands to a greater value then the result is clamped to the lower bound 0.- Parameters:
- a- the first operand.
- b- the second operand.
- Returns:
- the saturating difference of the operands.
- See Also:
 
- 
minUnsignedpublic static short minUnsigned(short a, short b) Returns the smaller of twoshortvalues numerically treating the values as unsigned. That is, the result is the operand closer to the value of the expression0. If the operands have the same value, the result is that same value.- Parameters:
- a- the first operand.
- b- the second operand.
- Returns:
- the smaller of aandb.
- See Also:
 
- 
maxUnsignedpublic static short maxUnsigned(short a, short b) Returns the greater of twoshortvalues numerically treating the values as unsigned. That is, the result is the operand closer to the value of the expression0xFFFFnumerically treating it as unsigned. If the operands have the same value, the result is that same value.- Parameters:
- a- the first operand.
- b- the second operand.
- Returns:
- the larger of aandb.
- See Also:
 
- 
addSaturatingpublic static short addSaturating(short a, short b) Adds twoshortvalues using saturation arithemetic. The lower and upper (inclusive) bounds areShort.MIN_VALUEandShort.MAX_VALUE, respectively.If the result of the addition would otherwise overflow from a positive value to a negative value then the result is clamped to the upper bound Short.MAX_VALUE. If the result of the addition would otherwise underflow from a negative value to a positive value then the result is clamped to lower boundShort.MIN_VALUE.- Parameters:
- a- the first operand.
- b- the second operand.
- Returns:
- the saturating addition of the operands.
- See Also:
 
- 
subSaturatingpublic static short subSaturating(short a, short b) Subtracts twoshortvalues using saturation arithemetic. The lower and upper (inclusive) bounds areShort.MIN_VALUEandShort.MAX_VALUE, respectively.If the result of the subtraction would otherwise overflow from a positive value to a negative value then the result is clamped to the upper bound Short.MAX_VALUE. If the result of the subtraction would otherwise underflow from a negative value to a positive value then the result is clamped to lower boundShort.MIN_VALUE.- Parameters:
- a- the first operand.
- b- the second operand.
- Returns:
- the saturating difference of the operands.
- See Also:
 
- 
addSaturatingUnsignedpublic static short addSaturatingUnsigned(short a, short b) Adds twoshortvalues using saturation arithemetic and numerically treating the values as unsigned. The lower and upper (inclusive) bounds are0and0xFFFF, respectively, numerically treating them as unsigned.If the result of the unsigned addition would otherwise overflow from the greater of the two operands to a lesser value then the result is clamped to the upper bound 0xFFFF.- Parameters:
- a- the first operand.
- b- the second operand.
- Returns:
- the saturating addition of the operands.
- See Also:
 
- 
subSaturatingUnsignedpublic static short subSaturatingUnsigned(short a, short b) Subtracts twoshortvalues using saturation arithemetic and numerically treating the values as unsigned. The lower and upper (inclusive) bounds are0and0xFFFF, respectively, numerically treating them as unsigned.If the result of the unsigned subtraction would otherwise underflow from the lesser of the two operands to a greater value then the result is clamped to the lower bound 0.- Parameters:
- a- the first operand.
- b- the second operand.
- Returns:
- the saturating difference of the operands.
- See Also:
 
- 
minUnsignedpublic static byte minUnsigned(byte a, byte b) Returns the smaller of twobytevalues numerically treating the values as unsigned. That is, the result is the operand closer to the value of the expression0. If the operands have the same value, the result is that same value.- Parameters:
- a- the first operand.
- b- the second operand.
- Returns:
- the smaller of aandb.
- See Also:
 
- 
maxUnsignedpublic static byte maxUnsigned(byte a, byte b) Returns the greater of twobytevalues numerically treating the values as unsigned. That is, the result is the operand closer to the value of the expression0xFFnumerically treating it as unsigned. If the operands have the same value, the result is that same value.- Parameters:
- a- the first operand.
- b- the second operand.
- Returns:
- the larger of aandb.
- See Also:
 
- 
addSaturatingpublic static byte addSaturating(byte a, byte b) Adds twobytevalues using saturation arithemetic. The lower and upper (inclusive) bounds areByte.MIN_VALUEandByte.MAX_VALUE, respectively.If the result of the addition would otherwise overflow from a positive value to a negative value then the result is clamped to the upper bound Byte.MAX_VALUE. If the result of the addition would otherwise underflow from a negative value to a positive value then the result is clamped to lower boundByte.MIN_VALUE.- Parameters:
- a- the first operand.
- b- the second operand.
- Returns:
- the saturating addition of the operands.
- See Also:
 
- 
subSaturatingpublic static byte subSaturating(byte a, byte b) Subtracts twobytevalues using saturation arithemetic. The lower and upper (inclusive) bounds areByte.MIN_VALUEandByte.MAX_VALUE, respectively.If the result of the subtraction would otherwise overflow from a positive value to a negative value then the result is clamped to the upper bound Byte.MAX_VALUE. If the result of the subtraction would otherwise underflow from a negative value to a positive value then the result is clamped to lower boundByte.MIN_VALUE.- Parameters:
- a- the first operand.
- b- the second operand.
- Returns:
- the saturating difference of the operands.
- See Also:
 
- 
addSaturatingUnsignedpublic static byte addSaturatingUnsigned(byte a, byte b) Adds twobytevalues using saturation arithemetic and numerically treating the values as unsigned. The lower and upper (inclusive) bounds are0and0xFF, respectively, numerically treating them as unsigned.If the result of the unsigned addition would otherwise overflow from the greater of the two operands to a lesser value then the result is clamped to the upper bound 0xFF.- Parameters:
- a- the first operand.
- b- the second operand.
- Returns:
- the saturating addition of the operands.
- See Also:
 
- 
subSaturatingUnsignedpublic static byte subSaturatingUnsigned(byte a, byte b) Subtracts twobytevalues using saturation arithemetic and numerically treating the values as unsigned. The lower and upper (inclusive) bounds are0and0xFF, respectively, numerically treating them as unsigned.If the result of the unsigned subtraction would otherwise underflow from the lesser of the two operands to a greater value then the result is clamped to the lower bound 0.- Parameters:
- a- the first operand.
- b- the second operand.
- Returns:
- the saturating difference of the operands.
- See Also:
 
 
-