- Description
- Method Summary
- Method Details
- minUnsigned(long, long)
- maxUnsigned(long, long)
- addSaturating(long, long)
- subSaturating(long, long)
- addSaturatingUnsigned(long, long)
- subSaturatingUnsigned(long, long)
- minUnsigned(int, int)
- maxUnsigned(int, int)
- addSaturating(int, int)
- subSaturating(int, int)
- addSaturatingUnsigned(int, int)
- subSaturatingUnsigned(int, int)
- minUnsigned(short, short)
- maxUnsigned(short, short)
- addSaturating(short, short)
- subSaturating(short, short)
- addSaturatingUnsigned(short, short)
- subSaturatingUnsigned(short, short)
- minUnsigned(byte, byte)
- maxUnsigned(byte, byte)
- addSaturating(byte, byte)
- subSaturating(byte, byte)
- addSaturatingUnsigned(byte, byte)
- subSaturatingUnsigned(byte, byte)
Class VectorMath
VectorMath
contains methods for performing
scalar numeric operations in support of vector numeric operations.- Since:
- 24
-
Method Summary
Modifier and TypeMethodDescriptionstatic byte
addSaturating
(byte a, byte b) Adds twobyte
values using saturation arithemetic.static int
addSaturating
(int a, int b) Adds twoint
values using saturation arithemetic.static long
addSaturating
(long a, long b) Adds twolong
values using saturation arithemetic.static short
addSaturating
(short a, short b) Adds twoshort
values using saturation arithemetic.static byte
addSaturatingUnsigned
(byte a, byte b) Adds twobyte
values using saturation arithemetic and numerically treating the values as unsigned.static int
addSaturatingUnsigned
(int a, int b) Adds twoint
values using saturation arithemetic and numerically treating the values as unsigned.static long
addSaturatingUnsigned
(long a, long b) Adds twolong
values using saturation arithemetic and numerically treating the values as unsigned.static short
addSaturatingUnsigned
(short a, short b) Adds twoshort
values using saturation arithemetic and numerically treating the values as unsigned.static byte
maxUnsigned
(byte a, byte b) Returns the greater of twobyte
values numerically treating the values as unsigned.static int
maxUnsigned
(int a, int b) Returns the greater of twoint
values numerically treating the values as unsigned.static long
maxUnsigned
(long a, long b) Returns the greater of twolong
values numerically treating the values as unsigned.static short
maxUnsigned
(short a, short b) Returns the greater of twoshort
values numerically treating the values as unsigned.static byte
minUnsigned
(byte a, byte b) Returns the smaller of twobyte
values numerically treating the values as unsigned.static int
minUnsigned
(int a, int b) Returns the smaller of twoint
values numerically treating the values as unsigned.static long
minUnsigned
(long a, long b) Returns the smaller of twolong
values numerically treating the values as unsigned.static short
minUnsigned
(short a, short b) Returns the smaller of twoshort
values numerically treating the values as unsigned.static byte
subSaturating
(byte a, byte b) Subtracts twobyte
values using saturation arithemetic.static int
subSaturating
(int a, int b) Subtracts twoint
values using saturation arithemetic.static long
subSaturating
(long a, long b) Subtracts twolong
values using saturation arithemetic.static short
subSaturating
(short a, short b) Subtracts twoshort
values using saturation arithemetic.static byte
subSaturatingUnsigned
(byte a, byte b) Subtracts twobyte
values using saturation arithemetic and numerically treating the values as unsigned.static int
subSaturatingUnsigned
(int a, int b) Subtracts twoint
values using saturation arithemetic and numerically treating the values as unsigned.static long
subSaturatingUnsigned
(long a, long b) Subtracts twolong
values using saturation arithemetic and numerically treating the values as unsigned.static short
subSaturatingUnsigned
(short a, short b) Subtracts twoshort
values using saturation arithemetic and numerically treating the values as unsigned.
-
Method Details
-
minUnsigned
public static long minUnsigned(long a, long b) Returns the smaller of twolong
values 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
a
andb
. - See Also:
-
maxUnsigned
public static long maxUnsigned(long a, long b) Returns the greater of twolong
values numerically treating the values as unsigned. That is, the result is the operand closer to the value of the expression0xFFFFFFFF_FFFFFFFFL
numerically 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
a
andb
. - See Also:
-
addSaturating
public static long addSaturating(long a, long b) Adds twolong
values using saturation arithemetic. The lower and upper (inclusive) bounds areLong.MIN_VALUE
andLong.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:
-
subSaturating
public static long subSaturating(long a, long b) Subtracts twolong
values using saturation arithemetic. The lower and upper (inclusive) bounds areLong.MIN_VALUE
andLong.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:
-
addSaturatingUnsigned
public static long addSaturatingUnsigned(long a, long b) Adds twolong
values using saturation arithemetic and numerically treating the values as unsigned. The lower and upper (inclusive) bounds are0L
and0xFFFFFFFF_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:
-
subSaturatingUnsigned
public static long subSaturatingUnsigned(long a, long b) Subtracts twolong
values using saturation arithemetic and numerically treating the values as unsigned. The lower and upper (inclusive) bounds are0L
and0xFFFFFFFF_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:
-
minUnsigned
public static int minUnsigned(int a, int b) Returns the smaller of twoint
values 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
a
andb
. - See Also:
-
maxUnsigned
public static int maxUnsigned(int a, int b) Returns the greater of twoint
values numerically treating the values as unsigned. That is, the result is the operand closer to the value of the expression0xFFFFFFFF
numerically 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
a
andb
. - See Also:
-
addSaturating
public static int addSaturating(int a, int b) Adds twoint
values using saturation arithemetic. The lower and upper (inclusive) bounds areInteger.MIN_VALUE
andInteger.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:
-
subSaturating
public static int subSaturating(int a, int b) Subtracts twoint
values using saturation arithemetic. The lower and upper (inclusive) bounds areInteger.MIN_VALUE
andInteger.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:
-
addSaturatingUnsigned
public static int addSaturatingUnsigned(int a, int b) Adds twoint
values using saturation arithemetic and numerically treating the values as unsigned. The lower and upper (inclusive) bounds are0
and0xFFFFFFFF
, 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:
-
subSaturatingUnsigned
public static int subSaturatingUnsigned(int a, int b) Subtracts twoint
values using saturation arithemetic and numerically treating the values as unsigned. The lower and upper (inclusive) bounds are0
and-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:
-
minUnsigned
public static short minUnsigned(short a, short b) Returns the smaller of twoshort
values 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
a
andb
. - See Also:
-
maxUnsigned
public static short maxUnsigned(short a, short b) Returns the greater of twoshort
values numerically treating the values as unsigned. That is, the result is the operand closer to the value of the expression0xFFFF
numerically 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
a
andb
. - See Also:
-
addSaturating
public static short addSaturating(short a, short b) Adds twoshort
values using saturation arithemetic. The lower and upper (inclusive) bounds areShort.MIN_VALUE
andShort.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:
-
subSaturating
public static short subSaturating(short a, short b) Subtracts twoshort
values using saturation arithemetic. The lower and upper (inclusive) bounds areShort.MIN_VALUE
andShort.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:
-
addSaturatingUnsigned
public static short addSaturatingUnsigned(short a, short b) Adds twoshort
values using saturation arithemetic and numerically treating the values as unsigned. The lower and upper (inclusive) bounds are0
and0xFFFF
, 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:
-
subSaturatingUnsigned
public static short subSaturatingUnsigned(short a, short b) Subtracts twoshort
values using saturation arithemetic and numerically treating the values as unsigned. The lower and upper (inclusive) bounds are0
and0xFFFF
, 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:
-
minUnsigned
public static byte minUnsigned(byte a, byte b) Returns the smaller of twobyte
values 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
a
andb
. - See Also:
-
maxUnsigned
public static byte maxUnsigned(byte a, byte b) Returns the greater of twobyte
values numerically treating the values as unsigned. That is, the result is the operand closer to the value of the expression0xFF
numerically 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
a
andb
. - See Also:
-
addSaturating
public static byte addSaturating(byte a, byte b) Adds twobyte
values using saturation arithemetic. The lower and upper (inclusive) bounds areByte.MIN_VALUE
andByte.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:
-
subSaturating
public static byte subSaturating(byte a, byte b) Subtracts twobyte
values using saturation arithemetic. The lower and upper (inclusive) bounds areByte.MIN_VALUE
andByte.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:
-
addSaturatingUnsigned
public static byte addSaturatingUnsigned(byte a, byte b) Adds twobyte
values using saturation arithemetic and numerically treating the values as unsigned. The lower and upper (inclusive) bounds are0
and0xFF
, 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:
-
subSaturatingUnsigned
public static byte subSaturatingUnsigned(byte a, byte b) Subtracts twobyte
values using saturation arithemetic and numerically treating the values as unsigned. The lower and upper (inclusive) bounds are0
and0xFF
, 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:
-