Index: src/wasm/wasm-module-builder.cc |
diff --git a/src/wasm/wasm-module-builder.cc b/src/wasm/wasm-module-builder.cc |
index f5228439ce5b581ef943ae290c67c3b549a42883..c6e4ab6e956cce271d31568141154cf04e8ef70a 100644 |
--- a/src/wasm/wasm-module-builder.cc |
+++ b/src/wasm/wasm-module-builder.cc |
@@ -122,10 +122,10 @@ void WasmFunctionBuilder::EmitWithVarInt(WasmOpcode opcode, |
} |
void WasmFunctionBuilder::EmitI32Const(int32_t value) { |
- // TODO(titzer): variable-length signed and unsigned i32 constants. |
- if (-128 <= value && value <= 127) { |
- EmitWithU8(kExprI8Const, static_cast<byte>(value)); |
+ if (-64 <= value && value <= 63) { |
+ EmitWithU8(kExprI32Const, static_cast<byte>(value & 0x7F)); |
} else { |
+ // TODO(titzer): variable-length signed and unsigned i32 constants. |
byte code[] = {WASM_I32V_5(value)}; |
EmitCode(code, sizeof(code)); |
} |