coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
helpers.h File Reference
Include dependency graph for helpers.h:

Go to the source code of this file.

Macros

#define DIV_ROUND_CLOSEST(x, divisor)
 
#define container_of(ptr, type, member)
 container_of - cast a member of a structure out to the containing structure More...
 
#define __unused   __attribute__((unused))
 
#define alloca(x)   __builtin_alloca(x)
 

Macro Definition Documentation

◆ __unused

#define __unused   __attribute__((unused))

Definition at line 38 of file helpers.h.

◆ alloca

#define alloca (   x)    __builtin_alloca(x)

Definition at line 42 of file helpers.h.

◆ container_of

#define container_of (   ptr,
  type,
  member 
)
Value:
({ \
const __typeof__(((type *)0)->member) *__mptr = (ptr); \
(type *)((char *)__mptr - offsetof(type, member)); })
#define offsetof(TYPE, MEMBER)
Definition: helpers.h:84
unsigned int type
Definition: edid.c:57

container_of - cast a member of a structure out to the containing structure

Parameters
ptrthe pointer to the member.
typethe type of the container struct this is embedded in.
memberthe name of the member within the struct.

Definition at line 33 of file helpers.h.

◆ DIV_ROUND_CLOSEST

#define DIV_ROUND_CLOSEST (   x,
  divisor 
)
Value:
({ \
__typeof__(x) _div_local_x = (x); \
__typeof__(divisor) _div_local_d = (divisor); \
(((__typeof__(x))-1) > 0 || \
((__typeof__(divisor))-1) > 0 || (_div_local_x) > 0) ? \
((_div_local_x + (_div_local_d / 2)) / _div_local_d) : \
((_div_local_x - (_div_local_d / 2)) / _div_local_d); \
})
int x
Definition: edid.c:994

Definition at line 17 of file helpers.h.