diff options
Diffstat (limited to 'src/literal.h')
-rw-r--r-- | src/literal.h | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/literal.h b/src/literal.h index 0c9f9da96..2e3f901cc 100644 --- a/src/literal.h +++ b/src/literal.h @@ -28,10 +28,6 @@ namespace wasm { class Literal { -public: - Type type; - -private: // store only integers, whose bits are deterministic. floats // can have their signalling bit set, for example. union { @@ -41,14 +37,17 @@ private: }; public: - Literal() : type(Type::none), v128() {} - explicit Literal(Type type) : type(type), v128() {} - explicit Literal(int32_t init) : type(Type::i32), i32(init) {} - explicit Literal(uint32_t init) : type(Type::i32), i32(init) {} - explicit Literal(int64_t init) : type(Type::i64), i64(init) {} - explicit Literal(uint64_t init) : type(Type::i64), i64(init) {} - explicit Literal(float init) : type(Type::f32), i32(bit_cast<int32_t>(init)) {} - explicit Literal(double init) : type(Type::f64), i64(bit_cast<int64_t>(init)) {} + Type type; + +public: + Literal() : v128(), type(Type::none) {} + explicit Literal(Type type) : v128(), type(type) {} + explicit Literal(int32_t init) : i32(init), type(Type::i32) {} + explicit Literal(uint32_t init) : i32(init), type(Type::i32) {} + explicit Literal(int64_t init) : i64(init), type(Type::i64) {} + explicit Literal(uint64_t init) : i64(init), type(Type::i64) {} + explicit Literal(float init) : i32(bit_cast<int32_t>(init)), type(Type::f32) {} + explicit Literal(double init) : i64(bit_cast<int64_t>(init)), type(Type::f64) {} // v128 literal from bytes explicit Literal(const uint8_t init[16]); // v128 literal from lane value literals |