This is set of small and generally "one can live without" utilities, which may make one's life easier. More...
Modules | |
| Assertions | |
| CMRX SDK provides assertiong mechanism. | |
This is set of small and generally "one can live without" utilities, which may make one's life easier.
| #define CONTAINER_OF | ( | ptr, | |
| type, | |||
| member | |||
| ) |
Return pointer to enclosing container.
This macro will provide a pointer to container enclosing the member of certain type. Useful for traversing up the data structure without having back-pointers.
| ptr | pointer to known container member |
| type | type of the enclosing container |
| member | name of the member inside enclosing container |
| #define LENGTH | ( | obj | ) | (sizeof(obj)/sizeof(obj[0])) |
Returns length (count of items) in static array.
This function is a shortcut for determining size of typed static array. It is useful for determining amount of for iterations. Type of item must be known at compile time.
| obj | statically allocated array of known type |
| #define LOG2 | ( | x | ) | (31 - __builtin_clz((uint32_t) x)) |
Returns integer lowest aproximation of log_2 for given value.
Provides approximation of binary logarithm of given value. More specifically returns log_2 of lowest set bit. This may be useful during bit unmasking.
| x | value |