Friday, January 13, 2012

Write a macro for set and reset, swap.

#define SET_BIT( _X_, _NO_ ) ( 1<<(_X_-1)) | _NO_
#define RESET_BIT( _X_, _NO_ ) ~( ( 1<<(_X_-1) ) ) & _NO_
#define SWAP_BIT( _X_, _NO_ ) ( 1<<(_X_-1)) ^ _NO_

No comments:

Post a Comment