SyterKit 0.4.0.x
SyterKit is a bare-metal framework
Loading...
Searching...
No Matches
Macros
stddef.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define NULL   ((void *) 0)
 
#define offsetof(type, field)   ((size_t) (&((type *) 0)->field))
 
#define container_of(ptr, type, member)
 
#define likely(expr)   (!!(expr))
 
#define unlikely(expr)   (!!(expr))
 
#define min(a, b)   (((a) < (b)) ? (a) : (b))
 
#define max(a, b)   (((a) > (b)) ? (a) : (b))
 
#define clamp(v, a, b)   min(max(a, v), b)
 
#define ifloor(x)   ((x) > 0 ? (int) (x) : (int) ((x) -0.9999999999))
 
#define iround(x)   ((x) > 0 ? (int) ((x) + 0.5) : (int) ((x) -0.5))
 
#define iceil(x)   ((x) > 0 ? (int) ((x) + 0.9999999999) : (int) (x))
 
#define idiv255(x)   ((((int) (x) + 1) * 257) >> 16)
 

Macro Definition Documentation

◆ clamp

#define clamp (   v,
  a,
 
)    min(max(a, v), b)

◆ 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, field)
Definition stddef.h:13

◆ iceil

#define iceil (   x)    ((x) > 0 ? (int) ((x) + 0.9999999999) : (int) (x))

◆ idiv255

#define idiv255 (   x)    ((((int) (x) + 1) * 257) >> 16)

◆ ifloor

#define ifloor (   x)    ((x) > 0 ? (int) (x) : (int) ((x) -0.9999999999))

◆ iround

#define iround (   x)    ((x) > 0 ? (int) ((x) + 0.5) : (int) ((x) -0.5))

◆ likely

#define likely (   expr)    (!!(expr))

◆ max

#define max (   a,
 
)    (((a) > (b)) ? (a) : (b))

◆ min

#define min (   a,
 
)    (((a) < (b)) ? (a) : (b))

◆ NULL

#define NULL   ((void *) 0)

◆ offsetof

#define offsetof (   type,
  field 
)    ((size_t) (&((type *) 0)->field))

◆ unlikely

#define unlikely (   expr)    (!!(expr))