bit_field

bit_field (비트 필드)

비트 필드는 구조체 멤버가 차지하는 비트 수를 지정하는 기능이에요.

출처: cppreference

본문

비트 필드는 멤버의 너비를 비트로 정해요.

struct Flags {
    unsigned int a : 1;  // 1비트
    unsigned int b : 3;  // 3비트
};

메모리를 아끼거나 하드웨어 레지스터를 다룰 때 유용해요.

더 알아보기 (Learn more)

cppreference