CEIL_DIV
Description
Ceiling division: divide num by den rounding up. Equivalent to ceil(num / den) for non-negative inputs. Side-effect-free args only – num is evaluated twice.
Parameters
| Name | Direction | Description |
|---|---|---|
num |
in | Dividend. |
den |
in | Divisor (non-zero). |
Success
Returns the ceiling quotient.
Failure
Function cannot fail. Behaviour is undefined when den is zero.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Budget.h:206:
PTR_ALIGN_UP_POW2((buf_ptr), 8u), \
0, \
CEIL_DIV( \
((size)(total_bytes) - (size)(ALIGN_UP_POW2((u64)(buf_ptr), 8u) - (u64)(buf_ptr))) / \
ALIGN_UP_POW2((slot_size_bytes), (alignment_value)), \
- In
Budget.h:226:
.buf_bytes = (total_bytes), \
.bitmap = (u64 *)PTR_ALIGN_UP_POW2((buf_ptr), 8u), \
.bitmap_words = (u32)CEIL_DIV( \
((size)(total_bytes) - (size)(ALIGN_UP_POW2((u64)(buf_ptr), 8u) - (u64)(buf_ptr))) / \
ALIGN_UP_POW2((slot_size_bytes), (alignment_value)), \
- In
Budget.h:233:
.slots = (u8 *)ALIGN_UP_POW2( \
ALIGN_UP_POW2((u64)(buf_ptr), 8u) + \
CEIL_DIV( \
((size)(total_bytes) - (size)(ALIGN_UP_POW2((u64)(buf_ptr), 8u) - (u64)(buf_ptr))) / \
ALIGN_UP_POW2((slot_size_bytes), (alignment_value)), \
- In
Budget.h:243:
.slot_count = \
((size)(total_bytes) - (size)(ALIGN_UP_POW2((u64)(buf_ptr), 8u) - (u64)(buf_ptr)) - \
CEIL_DIV( \
((size)(total_bytes) - (size)(ALIGN_UP_POW2((u64)(buf_ptr), 8u) - (u64)(buf_ptr))) / \
ALIGN_UP_POW2((slot_size_bytes), (alignment_value)), \
- In
Budget.h:250:
(size)(ALIGN_UP_POW2( \
ALIGN_UP_POW2((u64)(buf_ptr), 8u) + \
CEIL_DIV( \
((size)(total_bytes) - (size)(ALIGN_UP_POW2((u64)(buf_ptr), 8u) - (u64)(buf_ptr))) / \
ALIGN_UP_POW2((slot_size_bytes), (alignment_value)), \
- In
Budget.h:258:
) - \
ALIGN_UP_POW2((u64)(buf_ptr), 8u) - \
CEIL_DIV( \
((size)(total_bytes) - (size)(ALIGN_UP_POW2((u64)(buf_ptr), 8u) - (u64)(buf_ptr))) / \
ALIGN_UP_POW2((slot_size_bytes), (alignment_value)), \
- In
Int.c:396:
u64 IntByteLength(const Int *value) {
u64 bits = IntBitLength(value);
return bits == 0 ? 0 : CEIL_DIV(bits, 8u);
}- In
Int.c:1013:
u64 bits = IntBitLength(value);
u64 bytes = bits == 0 ? 0 : CEIL_DIV(bits, 8u);
const u8 *magnitude = (const u8 *)BitVecData(INT_BITS(value));
for (u64 i = 0; i < bytes; i++) {- In
Slab.c:111:
}
size slots_per_slab = page_size >> slab->slot_size_shift;
size words = CEIL_DIV(slots_per_slab, 64u);
if (words == 0u) {
words = 1u; // one slot fits in one bitmap bit; still need one word.
Last updated on