diff options
| Commit | 615397eb2c179787e23867e86907113d7c169c88 (patch) | |
|---|---|---|
| Author | 2020-10-04 08:36:11 +0300 | |
| Committer | 2020-10-05 22:13:47 +0300 | |
| Files | cb502d0a3ffdf0d2c2d900f7669719bc80a6f6e5 /spasm/src | |
| IPL-615397eb2c179787e23867e86907113d7c169c88.tar IPL-615397eb2c179787e23867e86907113d7c169c88.tar.gz IPL-615397eb2c179787e23867e86907113d7c169c88.zip | ||
| Parent | d4758752cb0b76c1a4e87d7e2a211bc5ad53bd0d (diff) | |
Add 32-bit platforms to projects and CI
1 files changed, 12 insertions, 13 deletions
| -rw-r--r-- | spasm/src/value.hpp | 25 |
diff --git a/spasm/src/value.hpp b/spasm/src/value.hpp index d86c0ef..725d48c 100644 --- a/spasm/src/value.hpp +++ b/spasm/src/value.hpp @@ -25,39 +25,38 @@ struct Value explicit Value(double v) { m_value.as_double = v; } - explicit Value(bool v) : Value(ValueType::Boolean, (size_t)v) {} + explicit Value(bool v) : Value(ValueType::Boolean, (uint64_t)v) {} - Value(ValueType tag, size_t payload) + Value(ValueType tag, uint64_t payload) { assert(tag != ValueType::Number && "Zero tag is plain double"); assert(!(payload >> 48) && "Use only pointers to the heap."); m_value.as_pointer.pointer = payload; - m_value.as_pointer.tag = size_t(tag); + m_value.as_pointer.tag = uint64_t(tag); m_value.as_pointer.nan = 0x1fff; } - Value(ValueType tag, void* pointer) : Value(tag, (size_t)pointer) {} + Value(ValueType tag, void* pointer) : Value(tag, (uint64_t)pointer) {} struct NanPointer { - size_t pointer : 48; - size_t tag : 3; - size_t nan : 13; + uint64_t pointer : 48; + uint64_t tag : 3; + uint64_t nan : 13; }; struct CheckType { - size_t payload : 48; - size_t check : 16; + uint64_t payload : 48; + uint64_t check : 16; }; union { double as_double; NanPointer as_pointer; CheckType to_check; - size_t as_int64; + uint64_t as_int64; } m_value; - static_assert(sizeof(size_t) == 8, "unsupported arch"); static_assert(sizeof(double) == 8, "unsupported arch"); bool is_double() const { return m_value.to_check.check <= 0xFFF8; } @@ -76,7 +75,7 @@ struct Value void* get_pointer() const { - return (void*)(size_t)m_value.as_pointer.pointer; + return (void*)(uint64_t)m_value.as_pointer.pointer; } bool get_boolean() const @@ -173,4 +172,4 @@ inline Value operator!=(const Value& lhs, const Value& rhs) return Value(lhs.get_double() != rhs.get_double()); } -} // namespace Spasm
\ No newline at end of file +} // namespace Spasm |
