From 58b0f90f29f4aff78741aff1fb4377dc676ccd9a Mon Sep 17 00:00:00 2001 From: MaxGraey Date: Tue, 9 Aug 2022 09:31:05 +0300 Subject: [PATCH] add v128 case for makeNegOne --- src/compiler.ts | 8 +++++--- src/util/vector.ts | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/compiler.ts b/src/compiler.ts index c5741d2436..4d9f4c0f8b 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -197,10 +197,11 @@ import { writeV128, cloneMap, isPowerOf2, - v128_zero, readI32, isIdentifier, - accuratePow64 + accuratePow64, + v128_zero, + v128_ones, } from "./util"; import { @@ -957,7 +958,7 @@ export class Compiler extends DiagnosticEmitter { element.identifierNode.range ); } - + // files /** Compiles the file matching the specified path. */ @@ -10187,6 +10188,7 @@ export class Compiler extends DiagnosticEmitter { case TypeKind.U64: return module.i64(-1, -1); case TypeKind.F32: return module.f32(-1); case TypeKind.F64: return module.f64(-1); + case TypeKind.V128: return module.v128(v128_ones); case TypeKind.I31REF: return module.i31_new(module.i32(-1)); } } diff --git a/src/util/vector.ts b/src/util/vector.ts index eee9d7ad78..2c0c0f2258 100644 --- a/src/util/vector.ts +++ b/src/util/vector.ts @@ -5,3 +5,5 @@ /** v128 zero constant. */ export const v128_zero = new Uint8Array(16); +/** v128 all ones constant. */ +export const v128_ones = new Uint8Array(16).fill(0xFF);