PZ80emu  0.1
Macros
utils.h File Reference

Utility macros. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define IS_SET(val, bit)   (bool)((val) & (1 << (bit)))
 Determines if a bit is set or not. More...
 
#define SET(val, bit)   ((val) |= (1 << (bit)))
 Sets a bit. More...
 
#define RESET(val, bit)   ((val) &= ~(1 << (bit)))
 Resets a bit. More...
 
#define TOGGLE(val, bit)   ((val) ^= (1 << (bit)))
 Toggles a bit. More...
 

Detailed Description

Utility macros.

Author
Peter H. Ezetta
Date
2016-02-27

Macro Definition Documentation

◆ IS_SET

#define IS_SET (   val,
  bit 
)    (bool)((val) & (1 << (bit)))

Determines if a bit is set or not.

Parameters
valBitfield to check
bitPosition of bit in field
Returns
0 == Checked Bit False, 1 == Checked Bit True.

◆ RESET

#define RESET (   val,
  bit 
)    ((val) &= ~(1 << (bit)))

Resets a bit.

Parameters
valBitfield to check
bitPosition of bit in field

◆ SET

#define SET (   val,
  bit 
)    ((val) |= (1 << (bit)))

Sets a bit.

Parameters
valBitfield to check
bitPosition of bit in field

◆ TOGGLE

#define TOGGLE (   val,
  bit 
)    ((val) ^= (1 << (bit)))

Toggles a bit.

Parameters
valBitfield to check
bitPosition of bit in field