Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
構造体の一部である配列のビットフィールドを使用できますか? これはCで可能ですか?
typedef struct convert { unsigned char data[7] : 5; //5x7 };
いいえ、それはできません。
int
struct
配列が十分に小さい場合は、それらに個別の名前を割り当てて 7 つの 5 ビット ビットフィールドを作成できますが、それはおそらくあなたが望むものではありません。
マクロを使用して手動でシフトするのが最善の策であり、高速です。