Index: src/wasm/wasm-macro-gen.h |
diff --git a/src/wasm/wasm-macro-gen.h b/src/wasm/wasm-macro-gen.h |
index 7e50d03fd6335563b9a2de5cabf5b5e3bd1a59a8..1d188c2b5d7030e06b4c6c1abeb5f03849ffadff 100644 |
--- a/src/wasm/wasm-macro-gen.h |
+++ b/src/wasm/wasm-macro-gen.h |
@@ -277,4 +277,28 @@ |
#define FUNC_INDEX(v) U16_LE(v) |
#define NAME_OFFSET(v) U32_LE(v) |
+#define MASK_7 ((1 << 7) - 1) |
bradn
2016/02/29 06:30:00
These are only used in one test, move them there?
titzer
2016/02/29 16:51:46
The plan is to use U32V_1, U32V_2, etc in more tes
|
+#define MASK_14 ((1 << 14) - 1) |
+#define MASK_21 ((1 << 21) - 1) |
+#define MASK_28 ((1 << 28) - 1) |
+ |
+#define U32V_1(x) static_cast<byte>(x & MASK_7) |
+#define U32V_2(x) \ |
+ static_cast<byte>((x & MASK_7) | 0x80), static_cast<byte>((x >> 7) & MASK_7) |
+#define U32V_3(x) \ |
+ static_cast<byte>((x & MASK_7) | 0x80), \ |
+ static_cast<byte>(((x >> 7) & MASK_7) | 0x80), \ |
+ static_cast<byte>((x >> 14) & MASK_7) |
+#define U32V_4(x) \ |
+ static_cast<byte>((x & MASK_7) | 0x80), \ |
+ static_cast<byte>(((x >> 7) & MASK_7) | 0x80), \ |
+ static_cast<byte>(((x >> 14) & MASK_7) | 0x80), \ |
+ static_cast<byte>((x >> 21) & MASK_7) |
+#define U32V_5(x) \ |
+ static_cast<byte>((x & MASK_7) | 0x80), \ |
+ static_cast<byte>(((x >> 7) & MASK_7) | 0x80), \ |
+ static_cast<byte>(((x >> 14) & MASK_7) | 0x80), \ |
+ static_cast<byte>(((x >> 21) & MASK_7) | 0x80), \ |
+ static_cast<byte>((x >> 28) & 0xF) |
+ |
#endif // V8_WASM_MACRO_GEN_H_ |