引入位图

This commit is contained in:
2024-09-07 20:51:43 +08:00
parent 578515d65f
commit 862d175462
4 changed files with 94 additions and 0 deletions

37
include/Bitmap.h Normal file
View File

@@ -0,0 +1,37 @@
// 版权所有 (c) ling 保留所有权利。
// 除非另行说明否则仅允许在DataStruct中使用此文件中的代码。
//
// 由 ling 创建于 24-9-7.
//
#ifndef DATASTRUCT_BITMAP_H_48
#define DATASTRUCT_BITMAP_H_48
#include <cstddef>
#include <cstdint>
namespace ling {
/**
* 位图
*/
class Bitmap {
private:
size_t size;
int32_t *buf;
public:
explicit Bitmap(size_t size);
virtual ~Bitmap();
bool test(size_t index) const;
void set(size_t index);
void clear(size_t index);
size_t getSize() const;
};
} // ling
#endif //DATASTRUCT_BITMAP_H_48