typed_varint_static
stdlib/typed/typed_varint_static.nbv
typed_varint_static(static n)
The postcard (LEB128) varint bytes of a static n, see typed_varint_len.
- Calls
typed/typed_varint_len- Precompiles
div_floor!,if_lt!,loop!,modulo!- Used by
typed/typed_bytes_check
Source
# The postcard (LEB128) varint bytes of a static `n`, see typed_varint_len.
(static n)
static l = typed_varint_len(n)
static mut out[l]
static mut x = n
loop! l, i {
out[i] = modulo! x, 128
x = div_floor! x, 128
if_lt! i, l - 1 {
out[i] = out[i] + 128
}
}
out