include/util.h File Reference

Misc utility functions and definitions. More...

#include <compiler.h>
#include <stdint.h>
#include <types.h>

Go to the source code of this file.

Defines

#define xstr(s)   str(s)
 Stringify the result after expansion of a macro argument.
#define str(s)   #s
 Stringify a macro argument without expansion.
#define ARRAY_LEN(a)   (sizeof(a) / sizeof((a)[0]))
 Get the number of elements in array a.
#define container_of(ptr, type, member)   ((type *)((uintptr_t)(ptr) - offsetof(type, member)))
 Get the containing object.
#define round_down(x, order)
 Round down to the nearest power of two boundary.
#define round_up(x, order)
 Round up to the nearest power of two boundary.
#define div_ceil(a, b)   (((a) + (b) - 1) / (b))
 Calculate $ \left\lceil \frac{a}{b} \right\rceil $ using integer arithmetic.
Minimum and Maximum

#define min_s(a, b)
 Get the lowest of two signed values.
#define min_u(a, b)
 Get the lowest of two unsigned values.
#define max_s(a, b)
 Get the highest of two signed values.
#define max_u(a, b)
 Get the highest of two unsigned values.

Functions

static int isdigit (int c)
 Determine whether or not the character c is a digit.
static int iscntrl (int c)
 Determine whether or not the character c is a control character.
static int isspace (int c)
 Determine whether or not the character c is a space.
int_fast8_t ilog2_undefined (void)
static __always_inline int_fast8_t ilog2 (uint32_t x)
 Calculate the base-2 logarithm of a number rounded down to the nearest integer.
static __always_inline bool is_power_of_two (unsigned long x)
 Test if a given value is a power of two.
static unsigned long word_align (unsigned long x)
 Round up to the nearest word-aligned boundary.

Detailed Description

Misc utility functions and definitions.

Copyright (C) 2009 Atmel Corporation. All rights reserved.

Definition in file util.h.

Generated on Thu Apr 29 14:10:34 2010 for xplain-bc by  doxygen 1.6.3