Struct soroban_env_guest::RawVal
source · pub struct RawVal(_);
Expand description
A 64-bit value encoding a bit-packed disjoint union between several different types (numbers, booleans, symbols, object handles, etc.)
RawVals divide up the space of 64 bits according to a 2-level tagging
scheme. The first tag is a bit in the least-significant position, indicating
whether the RawVal
is a plain “u63” 63-bit unsigned integer, or some
more-structured value with a second-level tag in the next most significant 3
bits. The 63-bit unsigned integer case can also be thought of as handling
the complete range of non-negative signed 64-bit integers.
The remaining 3 bit tags are assigned to cases enumerated in Tag, of which 7 are defined and one is currently reserved.
Schematically, the bit-assignment for RawVal
looks like this:
0x_NNNN_NNNN_NNNN_NNNX - u63, for any even X
0x_0000_000N_NNNN_NNN1 - u32
0x_0000_000N_NNNN_NNN3 - i32
0x_NNNN_NNNN_NNNN_NNN5 - static: void, true, false, ...
0x_IIII_IIII_TTTT_TTT7 - object: 32-bit index I, 28-bit type code T
0x_NNNN_NNNN_NNNN_NNN9 - symbol: up to 10 6-bit identifier characters
0x_NNNN_NNNN_NNNN_NNNb - bitset: up to 60 bits
0x_CCCC_CCCC_TTTT_TTTd - status: 32-bit code C, 28-bit type code T
0x_NNNN_NNNN_NNNN_NNNf - reserved