IntByteLength
IntByteLength
Description
Get the minimum number of bytes needed to encode an integer.
Parameters
| Name | Direction | Description |
|---|---|---|
value |
in | Integer to inspect |
Usage example (from documentation)
u64 bytes = IntByteLength(&value);Returns
Number of bytes required to represent the value, or 0 for zero.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Io.c:2616:
if (fmt_info->flags & FMT_FLAG_CHAR) {
u64 byte_len = IntByteLength(value);
if (byte_len == 0) {- In
Int.c:288:
}
u64 IntByteLength(Int *value) {
u64 bits = IntBitLength(value);
return bits == 0 ? 0 : (bits + 7) / 8;- In
Int.c:403:
}
u64 bytes_needed = IntByteLength(value);
u64 bytes_to_copy = MIN2(bytes_needed, max_len);- In
Int.c:455:
}
u64 bytes_needed = IntByteLength(value);
u64 bytes_to_copy = MIN2(bytes_needed, max_len);- In
Int.Access.c:30:
bool test_int_byte_length(void) {
WriteFmt("Testing IntByteLength\n");
Int value = IntFromBinary("0001001000110100");- In
Int.Access.c:34:
Int value = IntFromBinary("0001001000110100");
bool result = IntByteLength(&value) == 2;
IntDeinit(&value);
Last updated on