aboutsummaryrefslogtreecommitdiff
path: root/CPP/7zip/Compress/BitlDecoder.h
diff options
context:
space:
mode:
Diffstat (limited to 'CPP/7zip/Compress/BitlDecoder.h')
-rw-r--r--CPP/7zip/Compress/BitlDecoder.h22
1 files changed, 11 insertions, 11 deletions
diff --git a/CPP/7zip/Compress/BitlDecoder.h b/CPP/7zip/Compress/BitlDecoder.h
index 825864d..789ad1f 100644
--- a/CPP/7zip/Compress/BitlDecoder.h
+++ b/CPP/7zip/Compress/BitlDecoder.h
@@ -1,7 +1,7 @@
1// BitlDecoder.h -- the Least Significant Bit of byte is First 1// BitlDecoder.h -- the Least Significant Bit of byte is First
2 2
3#ifndef __BITL_DECODER_H 3#ifndef ZIP7_INC_BITL_DECODER_H
4#define __BITL_DECODER_H 4#define ZIP7_INC_BITL_DECODER_H
5 5
6#include "../IStream.h" 6#include "../IStream.h"
7 7
@@ -54,14 +54,14 @@ public:
54 54
55 bool ThereAreDataInBitsBuffer() const { return this->_bitPos != kNumBigValueBits; } 55 bool ThereAreDataInBitsBuffer() const { return this->_bitPos != kNumBigValueBits; }
56 56
57 MY_FORCE_INLINE 57 Z7_FORCE_INLINE
58 void Normalize() 58 void Normalize()
59 { 59 {
60 for (; _bitPos >= 8; _bitPos -= 8) 60 for (; _bitPos >= 8; _bitPos -= 8)
61 _value = ((UInt32)_stream.ReadByte() << (kNumBigValueBits - _bitPos)) | _value; 61 _value = ((UInt32)_stream.ReadByte() << (kNumBigValueBits - _bitPos)) | _value;
62 } 62 }
63 63
64 MY_FORCE_INLINE 64 Z7_FORCE_INLINE
65 UInt32 ReadBits(unsigned numBits) 65 UInt32 ReadBits(unsigned numBits)
66 { 66 {
67 Normalize(); 67 Normalize();
@@ -102,7 +102,7 @@ public:
102 _normalValue = 0; 102 _normalValue = 0;
103 } 103 }
104 104
105 MY_FORCE_INLINE 105 Z7_FORCE_INLINE
106 void Normalize() 106 void Normalize()
107 { 107 {
108 for (; this->_bitPos >= 8; this->_bitPos -= 8) 108 for (; this->_bitPos >= 8; this->_bitPos -= 8)
@@ -113,21 +113,21 @@ public:
113 } 113 }
114 } 114 }
115 115
116 MY_FORCE_INLINE 116 Z7_FORCE_INLINE
117 UInt32 GetValue(unsigned numBits) 117 UInt32 GetValue(unsigned numBits)
118 { 118 {
119 Normalize(); 119 Normalize();
120 return ((this->_value >> (8 - this->_bitPos)) & kMask) >> (kNumValueBits - numBits); 120 return ((this->_value >> (8 - this->_bitPos)) & kMask) >> (kNumValueBits - numBits);
121 } 121 }
122 122
123 MY_FORCE_INLINE 123 Z7_FORCE_INLINE
124 void MovePos(unsigned numBits) 124 void MovePos(unsigned numBits)
125 { 125 {
126 this->_bitPos += numBits; 126 this->_bitPos += numBits;
127 _normalValue >>= numBits; 127 _normalValue >>= numBits;
128 } 128 }
129 129
130 MY_FORCE_INLINE 130 Z7_FORCE_INLINE
131 UInt32 ReadBits(unsigned numBits) 131 UInt32 ReadBits(unsigned numBits)
132 { 132 {
133 Normalize(); 133 Normalize();
@@ -138,10 +138,10 @@ public:
138 138
139 void AlignToByte() { MovePos((32 - this->_bitPos) & 7); } 139 void AlignToByte() { MovePos((32 - this->_bitPos) & 7); }
140 140
141 MY_FORCE_INLINE 141 Z7_FORCE_INLINE
142 Byte ReadDirectByte() { return this->_stream.ReadByte(); } 142 Byte ReadDirectByte() { return this->_stream.ReadByte(); }
143 143
144 MY_FORCE_INLINE 144 Z7_FORCE_INLINE
145 Byte ReadAlignedByte() 145 Byte ReadAlignedByte()
146 { 146 {
147 if (this->_bitPos == kNumBigValueBits) 147 if (this->_bitPos == kNumBigValueBits)
@@ -152,7 +152,7 @@ public:
152 } 152 }
153 153
154 // call it only if the object is aligned for byte. 154 // call it only if the object is aligned for byte.
155 MY_FORCE_INLINE 155 Z7_FORCE_INLINE
156 bool ReadAlignedByte_FromBuf(Byte &b) 156 bool ReadAlignedByte_FromBuf(Byte &b)
157 { 157 {
158 if (this->_stream.NumExtraBytes != 0) 158 if (this->_stream.NumExtraBytes != 0)