KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
regfield.h File Reference

Macros to help dealing with register fields. More...

#include <sys/cdefs.h>

Go to the source code of this file.

Macros

#define BIT(bit)   (1u << (bit))
 Create a mask with a bit set.
 
#define GENMASK(h, l)   ((0xffffffff << (l)) & (0xffffffff >> (31 - (h))))
 Create a mask with a range of bits set.
 
#define FIELD_GET(var, field)    (((var) & (field)) >> __builtin_ctz(field))
 Extract a field value from a variable.
 
#define FIELD_PREP(field, value)    (((value) << __builtin_ctz(field)) & (field))
 Prepare a field with a given value.
 

Detailed Description

Macros to help dealing with register fields.

Author
Paul Cercueil