IntByteLength
Description
Number of bytes required to store the integer (ceil of bit length over eight).
Parameters
| Name | Direction | Description |
|---|---|---|
value |
in | Integer to inspect. |
Success
Returns the byte length as a u64. Returns 0 when value is zero. The integer is not modified.
Failure
Function cannot fail.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Io.c:2988:
if (fmt_info->flags & FMT_FLAG_CHAR) {
u64 byte_len = IntByteLength(value);
if (byte_len == 0) {- In
Int.c:369:
}
u64 IntByteLength(const Int *value) {
u64 bits = IntBitLength(value);
return bits == 0 ? 0 : CEIL_DIV(bits, 8u);- In
Int.c:540:
}
u64 bytes_needed = IntByteLength(value);
u64 bytes_to_copy = MIN2(bytes_needed, max_len);- In
Int.c:594:
}
u64 bytes_needed = IntByteLength(value);
u64 bytes_to_copy = MIN2(bytes_needed, max_len);- In
Int.Access.c:34:
bool test_int_byte_length(void) {
WriteFmt("Testing IntByteLength\n");
DefaultAllocator alloc = DefaultAllocatorInit();- In
Int.Access.c:40:
Int value = IntFromBinary("0001001000110100", &alloc.base);
bool result = IntByteLength(&value) == 2;
IntDeinit(&value);
Last updated on