Skip to content

Commit 64ac6a8

Browse files
authored
Add v128 case for makeNegOne (#2425)
1 parent e612355 commit 64ac6a8

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Diff for: src/compiler.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,11 @@ import {
197197
writeV128,
198198
cloneMap,
199199
isPowerOf2,
200-
v128_zero,
201200
readI32,
202201
isIdentifier,
203-
accuratePow64
202+
accuratePow64,
203+
v128_zero,
204+
v128_ones,
204205
} from "./util";
205206

206207
import {
@@ -957,7 +958,7 @@ export class Compiler extends DiagnosticEmitter {
957958
element.identifierNode.range
958959
);
959960
}
960-
961+
961962
// files
962963

963964
/** Compiles the file matching the specified path. */
@@ -10153,6 +10154,7 @@ export class Compiler extends DiagnosticEmitter {
1015310154
case TypeKind.U64: return module.i64(-1, -1);
1015410155
case TypeKind.F32: return module.f32(-1);
1015510156
case TypeKind.F64: return module.f64(-1);
10157+
case TypeKind.V128: return module.v128(v128_ones);
1015610158
case TypeKind.I31REF: return module.i31_new(module.i32(-1));
1015710159
}
1015810160
}

Diff for: src/util/vector.ts

+2
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@
55

66
/** v128 zero constant. */
77
export const v128_zero = new Uint8Array(16);
8+
/** v128 all ones constant. */
9+
export const v128_ones = new Uint8Array(16).fill(0xFF);

0 commit comments

Comments
 (0)