How to define and work with an array of bits in C?

前端 未结 5 1876
遇见更好的自我
遇见更好的自我 2020-11-28 20:58

I want to create a very large array on which I write \'0\'s and \'1\'s. I\'m trying to simulate a physical process called random sequential adsorption, where units of length

5条回答
  •  -上瘾入骨i
    2020-11-28 21:44

    It's a trade-off:

    (1) use 1 byte for each 2 bit value - simple, fast, but uses 4x memory

    (2) pack bits into bytes - more complex, some performance overhead, uses minimum memory

    If you have enough memory available then go for (1), otherwise consider (2).

提交回复
热议问题