我需要一个Linux C中的位图API。
我需要2^18个位,因此需要32KB的内存。并且我会经常在位图中设置和取消位。
所以基本上我需要以下API:
set_bitmap(int i) // it sets the i-th bit to 1 in the bitmap
unset_bitmap(int i) // it sets the i-th bit to 0 in the bitmap
bitmap_t create_bitmap(int n) // it creates a bitmap of size n, like n=2^18
有没有任何源代码或类似的源代码?
谢谢!