Function varint_simd::decode_two_unsafe
source · pub unsafe fn decode_two_unsafe<T: VarIntTarget, U: VarIntTarget>(
bytes: *const u8
) -> (T, U, u8, u8)
Available with target feature
ssse3
only.Expand description
Decodes two adjacent varints simultaneously. Target types must fit within 16 bytes when varint encoded. Requires SSSE3 support.
For example, it is permissible to decode u32
and u32
, and u64
and u32
, but it is not
possible to decode two u64
values with this function simultaneously.
Returns a tuple containing the two decoded values and the two lengths of bytes read for each value.
For best performance, ensure each target type is u32
or smaller.
Safety
There must be at least 16 bytes of allocated memory after the start of the pointer. Otherwise, there may be undefined behavior. Any data after the two varints are ignored. Truncated values will be returned if a varint exceeds the target type’s limit.