APIdia Launch Partner
Top Description Constructors Methods
jdk.incubator.vector

public final Class VectorMath

extends Object
Class Inheritance

The class VectorMath contains methods for performing scalar numeric operations in support of vector numeric operations.
Since
24

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static long

Returns:

the saturating addition of the operands.
addSaturating
(long
the first operand.
a
,
long
the second operand.
b
)

Adds two long values using saturation arithmetic.

public static int

Returns:

the saturating addition of the operands.
addSaturating
(int
the first operand.
a
,
int
the second operand.
b
)

Adds two int values using saturation arithmetic.

public static short

Returns:

the saturating addition of the operands.
addSaturating
(short
the first operand.
a
,
short
the second operand.
b
)

Adds two short values using saturation arithmetic.

public static byte

Returns:

the saturating addition of the operands.
addSaturating
(byte
the first operand.
a
,
byte
the second operand.
b
)

Adds two byte values using saturation arithmetic.

public static long

Returns:

the saturating addition of the operands.
addSaturatingUnsigned
(long
the first operand.
a
,
long
the second operand.
b
)

Adds two long values using saturation arithmetic and numerically treating the values as unsigned.

public static int

Returns:

the saturating addition of the operands.
addSaturatingUnsigned
(int
the first operand.
a
,
int
the second operand.
b
)

Adds two int values using saturation arithmetic and numerically treating the values as unsigned.

public static short

Returns:

the saturating addition of the operands.
addSaturatingUnsigned
(short
the first operand.
a
,
short
the second operand.
b
)

Adds two short values using saturation arithmetic and numerically treating the values as unsigned.

public static byte

Returns:

the saturating addition of the operands.
addSaturatingUnsigned
(byte
the first operand.
a
,
byte
the second operand.
b
)

Adds two byte values using saturation arithmetic and numerically treating the values as unsigned.

public static long

Returns:

the larger of a and b.
maxUnsigned
(long
the first operand.
a
,
long
the second operand.
b
)

Returns the greater of two long values numerically treating the values as unsigned.

public static int

Returns:

the larger of a and b.
maxUnsigned
(int
the first operand.
a
,
int
the second operand.
b
)

Returns the greater of two int values numerically treating the values as unsigned.

public static short

Returns:

the larger of a and b.
maxUnsigned
(short
the first operand.
a
,
short
the second operand.
b
)

Returns the greater of two short values numerically treating the values as unsigned.

public static byte

Returns:

the larger of a and b.
maxUnsigned
(byte
the first operand.
a
,
byte
the second operand.
b
)

Returns the greater of two byte values numerically treating the values as unsigned.

public static long

Returns:

the smaller of a and b.
minUnsigned
(long
the first operand.
a
,
long
the second operand.
b
)

Returns the smaller of two long values numerically treating the values as unsigned.

public static int

Returns:

the smaller of a and b.
minUnsigned
(int
the first operand.
a
,
int
the second operand.
b
)

Returns the smaller of two int values numerically treating the values as unsigned.

public static short

Returns:

the smaller of a and b.
minUnsigned
(short
the first operand.
a
,
short
the second operand.
b
)

Returns the smaller of two short values numerically treating the values as unsigned.

public static byte

Returns:

the smaller of a and b.
minUnsigned
(byte
the first operand.
a
,
byte
the second operand.
b
)

Returns the smaller of two byte values numerically treating the values as unsigned.

public static long

Returns:

the saturating difference of the operands.
subSaturating
(long
the first operand.
a
,
long
the second operand.
b
)

Subtracts two long values using saturation arithmetic.

public static int

Returns:

the saturating difference of the operands.
subSaturating
(int
the first operand.
a
,
int
the second operand.
b
)

Subtracts two int values using saturation arithmetic.

public static short

Returns:

the saturating difference of the operands.
subSaturating
(short
the first operand.
a
,
short
the second operand.
b
)

Subtracts two short values using saturation arithmetic.

public static byte

Returns:

the saturating difference of the operands.
subSaturating
(byte
the first operand.
a
,
byte
the second operand.
b
)

Subtracts two byte values using saturation arithmetic.

public static long

Returns:

the saturating difference of the operands.
subSaturatingUnsigned
(long
the first operand.
a
,
long
the second operand.
b
)

Subtracts two long values using saturation arithmetic and numerically treating the values as unsigned.

public static int

Returns:

the saturating difference of the operands.
subSaturatingUnsigned
(int
the first operand.
a
,
int
the second operand.
b
)

Subtracts two int values using saturation arithmetic and numerically treating the values as unsigned.

public static short

Returns:

the saturating difference of the operands.
subSaturatingUnsigned
(short
the first operand.
a
,
short
the second operand.
b
)

Subtracts two short values using saturation arithmetic and numerically treating the values as unsigned.

public static byte

Returns:

the saturating difference of the operands.
subSaturatingUnsigned
(byte
the first operand.
a
,
byte
the second operand.
b
)

Subtracts two byte values using saturation arithmetic and numerically treating the values as unsigned.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

VectorMathback to summary
private VectorMath()

Method Detail

addSaturatingback to summary
public static long addSaturating(long a, long b)

Adds two long values using saturation arithmetic. The lower and upper (inclusive) bounds are Long.MIN_VALUE and Long.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 bound Long.MIN_VALUE.

Parameters
a:long

the first operand.

b:long

the second operand.

Returns:long

the saturating addition of the operands.

See Also
VectorOperators#SADD
addSaturatingback to summary
public static int addSaturating(int a, int b)

Adds two int values using saturation arithmetic. The lower and upper (inclusive) bounds are Integer.MIN_VALUE and Integer.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 bound Integer.MIN_VALUE.

Parameters
a:int

the first operand.

b:int

the second operand.

Returns:int

the saturating addition of the operands.

See Also
VectorOperators#SADD
addSaturatingback to summary
public static short addSaturating(short a, short b)

Adds two short values using saturation arithmetic. The lower and upper (inclusive) bounds are Short.MIN_VALUE and Short.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 bound Short.MIN_VALUE.

Parameters
a:short

the first operand.

b:short

the second operand.

Returns:short

the saturating addition of the operands.

See Also
VectorOperators#SADD
addSaturatingback to summary
public static byte addSaturating(byte a, byte b)

Adds two byte values using saturation arithmetic. The lower and upper (inclusive) bounds are Byte.MIN_VALUE and Byte.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 bound Byte.MIN_VALUE.

Parameters
a:byte

the first operand.

b:byte

the second operand.

Returns:byte

the saturating addition of the operands.

See Also
VectorOperators#SADD
addSaturatingUnsignedback to summary
public static long addSaturatingUnsigned(long a, long b)

Adds two long values using saturation arithmetic and numerically treating the values as unsigned. The lower and upper (inclusive) bounds are 0L and 0xFFFFFFFF_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:long

the first operand.

b:long

the second operand.

Returns:long

the saturating addition of the operands.

See Also
VectorOperators#SUADD
addSaturatingUnsignedback to summary
public static int addSaturatingUnsigned(int a, int b)

Adds two int values using saturation arithmetic and numerically treating the values as unsigned. The lower and upper (inclusive) bounds are 0 and 0xFFFFFFFF, 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:int

the first operand.

b:int

the second operand.

Returns:int

the saturating addition of the operands.

See Also
VectorOperators#SUADD
addSaturatingUnsignedback to summary
public static short addSaturatingUnsigned(short a, short b)

Adds two short values using saturation arithmetic and numerically treating the values as unsigned. The lower and upper (inclusive) bounds are 0 and 0xFFFF, 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:short

the first operand.

b:short

the second operand.

Returns:short

the saturating addition of the operands.

See Also
VectorOperators#SUADD
addSaturatingUnsignedback to summary
public static byte addSaturatingUnsigned(byte a, byte b)

Adds two byte values using saturation arithmetic and numerically treating the values as unsigned. The lower and upper (inclusive) bounds are 0 and 0xFF, 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:byte

the first operand.

b:byte

the second operand.

Returns:byte

the saturating addition of the operands.

See Also
VectorOperators#SUADD
maxUnsignedback to summary
public static long maxUnsigned(long a, long b)

Returns the greater of two long values numerically treating the values as unsigned. That is, the result is the operand closer to the value of the expression 0xFFFFFFFF_FFFFFFFFL numerically treating it as unsigned. If the operands have the same value, the result is that same value.

Parameters
a:long

the first operand.

b:long

the second operand.

Returns:long

the larger of a and b.

See Also
VectorOperators#UMAX
maxUnsignedback to summary
public static int maxUnsigned(int a, int b)

Returns the greater of two int values numerically treating the values as unsigned. That is, the result is the operand closer to the value of the expression 0xFFFFFFFF numerically treating it as unsigned. If the operands have the same value, the result is that same value.

Parameters
a:int

the first operand.

b:int

the second operand.

Returns:int

the larger of a and b.

See Also
VectorOperators#UMAX
maxUnsignedback to summary
public static short maxUnsigned(short a, short b)

Returns the greater of two short values numerically treating the values as unsigned. That is, the result is the operand closer to the value of the expression 0xFFFF numerically treating it as unsigned. If the operands have the same value, the result is that same value.

Parameters
a:short

the first operand.

b:short

the second operand.

Returns:short

the larger of a and b.

See Also
VectorOperators#UMAX
maxUnsignedback to summary
public static byte maxUnsigned(byte a, byte b)

Returns the greater of two byte values numerically treating the values as unsigned. That is, the result is the operand closer to the value of the expression 0xFF numerically treating it as unsigned. If the operands have the same value, the result is that same value.

Parameters
a:byte

the first operand.

b:byte

the second operand.

Returns:byte

the larger of a and b.

See Also
VectorOperators#UMAX
minUnsignedback to summary
public static long minUnsigned(long a, long b)

Returns the smaller of two long values numerically treating the values as unsigned. That is, the result is the operand closer to the value of the expression 0L. If the operands have the same value, the result is that same value.

Parameters
a:long

the first operand.

b:long

the second operand.

Returns:long

the smaller of a and b.

See Also
VectorOperators#UMIN
minUnsignedback to summary
public static int minUnsigned(int a, int b)

Returns the smaller of two int values numerically treating the values as unsigned. That is, the result is the operand closer to the value of the expression 0. If the operands have the same value, the result is that same value.

Parameters
a:int

the first operand.

b:int

the second operand.

Returns:int

the smaller of a and b.

See Also
VectorOperators#UMIN
minUnsignedback to summary
public static short minUnsigned(short a, short b)

Returns the smaller of two short values numerically treating the values as unsigned. That is, the result is the operand closer to the value of the expression 0. If the operands have the same value, the result is that same value.

Parameters
a:short

the first operand.

b:short

the second operand.

Returns:short

the smaller of a and b.

See Also
VectorOperators#UMIN
minUnsignedback to summary
public static byte minUnsigned(byte a, byte b)

Returns the smaller of two byte values numerically treating the values as unsigned. That is, the result is the operand closer to the value of the expression 0. If the operands have the same value, the result is that same value.

Parameters
a:byte

the first operand.

b:byte

the second operand.

Returns:byte

the smaller of a and b.

See Also
VectorOperators#UMIN
subSaturatingback to summary
public static long subSaturating(long a, long b)

Subtracts two long values using saturation arithmetic. The lower and upper (inclusive) bounds are Long.MIN_VALUE and Long.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 bound Long.MIN_VALUE.

Parameters
a:long

the first operand.

b:long

the second operand.

Returns:long

the saturating difference of the operands.

See Also
VectorOperators#SSUB
subSaturatingback to summary
public static int subSaturating(int a, int b)

Subtracts two int values using saturation arithmetic. The lower and upper (inclusive) bounds are Integer.MIN_VALUE and Integer.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 bound Integer.MIN_VALUE.

Parameters
a:int

the first operand.

b:int

the second operand.

Returns:int

the saturating difference of the operands.

See Also
VectorOperators#SSUB
subSaturatingback to summary
public static short subSaturating(short a, short b)

Subtracts two short values using saturation arithmetic. The lower and upper (inclusive) bounds are Short.MIN_VALUE and Short.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 bound Short.MIN_VALUE.

Parameters
a:short

the first operand.

b:short

the second operand.

Returns:short

the saturating difference of the operands.

See Also
VectorOperators#SSUB
subSaturatingback to summary
public static byte subSaturating(byte a, byte b)

Subtracts two byte values using saturation arithmetic. The lower and upper (inclusive) bounds are Byte.MIN_VALUE and Byte.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 bound Byte.MIN_VALUE.

Parameters
a:byte

the first operand.

b:byte

the second operand.

Returns:byte

the saturating difference of the operands.

See Also
VectorOperators#SSUB
subSaturatingUnsignedback to summary
public static long subSaturatingUnsigned(long a, long b)

Subtracts two long values using saturation arithmetic and numerically treating the values as unsigned. The lower and upper (inclusive) bounds are 0L and 0xFFFFFFFF_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:long

the first operand.

b:long

the second operand.

Returns:long

the saturating difference of the operands.

See Also
VectorOperators#SUSUB
subSaturatingUnsignedback to summary
public static int subSaturatingUnsigned(int a, int b)

Subtracts two int values using saturation arithmetic and numerically treating the values as unsigned. The lower and upper (inclusive) bounds are 0 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:int

the first operand.

b:int

the second operand.

Returns:int

the saturating difference of the operands.

See Also
VectorOperators#SUSUB
subSaturatingUnsignedback to summary
public static short subSaturatingUnsigned(short a, short b)

Subtracts two short values using saturation arithmetic and numerically treating the values as unsigned. The lower and upper (inclusive) bounds are 0 and 0xFFFF, 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:short

the first operand.

b:short

the second operand.

Returns:short

the saturating difference of the operands.

See Also
VectorOperators#SUSUB
subSaturatingUnsignedback to summary
public static byte subSaturatingUnsigned(byte a, byte b)

Subtracts two byte values using saturation arithmetic and numerically treating the values as unsigned. The lower and upper (inclusive) bounds are 0 and 0xFF, 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:byte

the first operand.

b:byte

the second operand.

Returns:byte

the saturating difference of the operands.

See Also
VectorOperators#SUSUB