MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/FleX / Bitmap

Class Bitmap

extensions/flexExtContainer.cpp:38–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36#include "../include/NvFlexExt.h"
37
38class Bitmap
39{
40public:
41
42 typedef unsigned int Word;
43
44 static const int kWordSize = sizeof(Word)*8;
45
46 Bitmap(int numBits) : mBits((numBits+kWordSize-1)/kWordSize)
47 {
48 }
49
50 inline void Set(int bit)
51 {
52 const int wordIndex = bit/kWordSize;
53 const int bitIndex = bit&(kWordSize-1);
54
55 const Word word = mBits[wordIndex];
56
57 mBits[wordIndex] = word|(1<<bitIndex);
58 }
59
60 inline void Reset(int bit)
61 {
62 const int wordIndex = bit/kWordSize;
63 const int bitIndex = bit&(kWordSize-1);
64
65 const Word word = mBits[wordIndex];
66
67 mBits[wordIndex] = word&~(1<<bitIndex);
68 }
69
70 inline bool IsSet(int bit)
71 {
72 const int wordIndex = bit/kWordSize;
73 const int bitIndex = bit&(kWordSize-1);
74
75 const Word word = mBits[wordIndex];
76
77 return (word & (1<<bitIndex)) != 0;
78 }
79
80private:
81
82 std::vector<Word> mBits;
83};
84
85
86struct NvFlexExtContainer

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected