#define Macro_Set_Bit(dest, position) ((dest) |= ((unsigned)0x1<<(position)))
#define Macro_Clear_Bit(dest, position) ((dest) &= ~((unsigned)0x1<<(position)))
#define Macro_Invert_Bit(dest, position) ((dest) ^= ((unsigned)0x1<<(position)))
#define Macro_Clear_Area(dest, bits, position) ((dest) &= ~(((unsigned)bits)<<(position)))
#define Macro_Set_Area(dest, bits, position) ((dest) |= (((unsigned)bits)<<(position)))
#define Macro_Invert_Area(dest, bits, position) ((dest) ^= (((unsigned)bits)<<(position)))
#define Macro_Write_Block(dest, bits, data, position) ((dest) = (((unsigned)dest) & ~(((unsigned)bits)<<(position))) | (((unsigned)data)<<(position)))
#define Macro_Check_Bit_Set(dest, position) ((((unsigned)dest)>>(position)) & 0x1)
#define Macro_Check_Bit_Clear(dest, position) (!((((unsigned)dest)>>(position)) & 0x1))
#define Macro_Extract_Area(dest, bits, position) ((((unsigned)dest)>>(position)) & (bits))반응형
'【Programming】 > C & C++' 카테고리의 다른 글
| [C++] 파벌 싸움으로 대신 선택되는 Rust (레거시 호환성 vs 모던 툴링으로 분열) (0) | 2025.04.25 |
|---|---|
| [C++] 구조체(struct) 생성자 (0) | 2025.04.25 |
| [C] Writing Efficient C and C Code Optimization (0) | 2013.07.11 |
| [C] 비트 필드의 인식과 코딩의 자유로움에 대하여 (0) | 2012.08.16 |
| [C] restrict type qualifier (0) | 2012.02.04 |
댓글