Skip to content

Commit 02da764

Browse files
committed
Avoid using Vector API's integer division
1 parent a201f53 commit 02da764

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

wasm/src/org.graalvm.wasm.jdk25/src/org/graalvm/wasm/api/Vector128OpsVectorAPI.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,8 +1042,7 @@ private static <E, F> ByteVector avgr_u(ByteVector xBytes, ByteVector yBytes,
10421042
Shape<E> shape, Shape<F> extendedShape,
10431043
VectorOperators.Conversion<E, F> upcast) {
10441044
Vector<F> one = extendedShape.broadcast(1);
1045-
Vector<F> two = extendedShape.broadcast(2);
1046-
return upcastBinopDowncast(xBytes, yBytes, shape, extendedShape, upcast, (x, y) -> x.add(y).add(one).div(two));
1045+
return upcastBinopDowncast(xBytes, yBytes, shape, extendedShape, upcast, (x, y) -> x.add(y).add(one).lanewise(VectorOperators.LSHR, 1));
10471046
}
10481047

10491048
private static ByteVector i16x8_q15mulr_sat_s(ByteVector xBytes, ByteVector yBytes) {

0 commit comments

Comments
 (0)