pub const fn usize32s_to_usize(lo: usize, hi: usize) -> usize
Expand description
Helper function to convert create a full, single usize value from two 32-bit values stored in usizes.
In C this would look like:
size_t v = (hi << 32) | (uint32_t) lo;
This is useful when passing a machine-sized value (i.e. a size_t
) via the
system call interface in two 32-bit usize values. On a 32-bit machine this
essentially has no effect; the full value is stored in the lo
usize. On a
64-bit machine, this creates a usize by concatenating the hi and lo 32-bit
values.
§TODO
This can be more succinctly implemented using
unbounded_shl()
.
However, that method is currently a nightly-only feature.