C/C++ efficient bit array

前端 未结 10 845
清酒与你
清酒与你 2020-11-29 02:15

Can you recommend efficient/clean way to manipulate arbitrary length bit array?

Right now I am using regular int/char bitmask, but those are not very clean when arra

10条回答
  •  星月不相逢
    2020-11-29 02:27

    In micro controller development, some times we need to use 2-dimentional array (matrix) with element value of [0, 1] only. That means if we use 1 byte for element type, it wastes the memory greatly (memory of micro controller is very limited). The proposed solution is that we should use 1 bit matrix (element type is 1 bit).

    http://htvdanh.blogspot.com/2016/09/one-bit-matrix-for-cc-programming.html

提交回复
热议问题