1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-26 15:03:53 +01:00

Merge pull request #4990 from OlegHahm/cib-fix

core: added documentation and assert to cib
This commit is contained in:
Martine Lenders 2016-03-10 15:29:26 +01:00
commit 28e2c14dab

View File

@ -21,6 +21,8 @@
#ifndef CIB_H
#define CIB_H
#include "assert.h"
#ifdef __cplusplus
extern "C" {
#endif
@ -45,9 +47,13 @@ typedef struct {
* @param[out] cib Buffer to initialize.
* Must not be NULL.
* @param[in] size Size of the buffer, must not exceed MAXINT/2.
* Should be equal to 0 or power of 2.
*/
static inline void cib_init(cib_t *__restrict cib, unsigned int size)
{
/* check if size is a power of 2 by comparing it to its complement */
assert(!(size & (size - 1)));
cib_t c = CIB_INIT(size);
*cib = c;
}