Skip to content

Add v128 case for makeNegOne #2425

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,11 @@ import {
writeV128,
cloneMap,
isPowerOf2,
v128_zero,
readI32,
isIdentifier,
accuratePow64
accuratePow64,
v128_zero,
v128_ones,
} from "./util";

import {
Expand Down Expand Up @@ -957,7 +958,7 @@ export class Compiler extends DiagnosticEmitter {
element.identifierNode.range
);
}

// files

/** Compiles the file matching the specified path. */
Expand Down Expand Up @@ -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));
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/util/vector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);