Rev 1990 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1990 | Rev 2118 | ||
|---|---|---|---|
| Line 62... | Line 62... | ||
| 62 | unsigned char* Bitset::GetBytes() const |
62 | unsigned char* Bitset::GetBytes() const |
| 63 | { |
63 | { |
| 64 | return this->bytes_; |
64 | return this->bytes_; |
| 65 | } |
65 | } |
| 66 | 66 | ||
| 67 |
|
67 | uint64_t Bitset::Read(unsigned int position, unsigned int length) |
| 68 | { |
68 | { |
| 69 |
|
69 | uint64_t value = 0; |
| 70 | 70 | ||
| 71 | for (unsigned int index = 0; index < length; index++) |
71 | for (unsigned int index = 0; index < length; index++) |
| 72 | { |
72 | { |
| 73 | value = (value << 1) | this->Get(position + index); |
73 | value = (value << 1) | this->Get(position + index); |
| 74 | } |
74 | } |
| 75 | 75 | ||
| 76 | return value; |
76 | return value; |
| 77 | } |
77 | } |
| 78 | 78 | ||
| 79 | void Bitset::Write(unsigned int position, unsigned int length, |
79 | void Bitset::Write(unsigned int position, unsigned int length, uint64_t value) |
| 80 | { |
80 | { |
| 81 | for (unsigned int index = 0; index < length; index++) |
81 | for (unsigned int index = 0; index < length; index++) |
| 82 | { |
82 | { |
| 83 | if (value & 0x01) |
83 | if (value & 0x01) |
| 84 | { |
84 | { |