CACAO
Functions
util.hpp File Reference

Go to the source code of this file.

Functions

int get_variable_message_length (const char *fmt, va_list ap)
 
static size_t next_power_of_two (size_t n)
 find the smallest power of two >= n More...
 
static bool is_power_of_two (size_t n)
 
static size_t fast_modulo (size_t n, size_t modul)
 fast computation of n % m. More...
 
static size_t divide_rounding_up (size_t a, size_t b)
 Perform unsigned integer division. More...
 

Function Documentation

static size_t divide_rounding_up ( size_t  a,
size_t  b 
)
inlinestatic

Perform unsigned integer division.

But instead of rounding the result down, round it up.

Definition at line 83 of file util.hpp.

static size_t fast_modulo ( size_t  n,
size_t  modul 
)
inlinestatic

fast computation of n % m.

m MUST be a power of two and greater than zero

Definition at line 72 of file util.hpp.

int get_variable_message_length ( const char *  fmt,
va_list  ap 
)

Definition at line 45 of file util.cpp.

static bool is_power_of_two ( size_t  n)
inlinestatic

Definition at line 63 of file util.hpp.

static size_t next_power_of_two ( size_t  n)
inlinestatic

find the smallest power of two >= n

Definition at line 41 of file util.hpp.