@@ -139,7 +139,7 @@ int ROLZCodec1::findMatch(const byte buf[], int pos, int end, uint32 hash32, con
139139 const byte* curBuf = &buf[pos];
140140 int bestLen = 0 ;
141141 int bestIdx = -1 ;
142- const int maxMatch = min (ROLZCodec1::MAX_MATCH, end - pos) - 4 ;
142+ const int maxMatch = min (ROLZCodec1::MAX_MATCH, end - pos) - 8 ;
143143
144144 // Check all recorded positions
145145 for (int i = s; i > e; i--) {
@@ -157,14 +157,14 @@ int ROLZCodec1::findMatch(const byte buf[], int pos, int end, uint32 hash32, con
157157 int n = 0 ;
158158
159159 while (n < maxMatch) {
160- const int32 diff = LittleEndian::readInt32 (&buf[ref + n]) ^ LittleEndian::readInt32 (&curBuf[n]);
160+ const int64 diff = LittleEndian::readLong64 (&buf[ref + n]) ^ LittleEndian::readLong64 (&curBuf[n]);
161161
162162 if (diff != 0 ) {
163- n += (Global::trailingZeros (uint32 (diff)) >> 3 );
163+ n += (Global::trailingZeros (uint64 (diff)) >> 3 );
164164 break ;
165165 }
166166
167- n += 4 ;
167+ n += 8 ;
168168 }
169169
170170 if (n > bestLen) {
@@ -811,7 +811,7 @@ int ROLZCodec2::findMatch(const byte buf[], int pos, int end, uint32 key)
811811 const uint32 hash32 = ROLZCodec::hash (curBuf);
812812 int bestLen = 0 ;
813813 int bestIdx = -1 ;
814- const int maxMatch = min (ROLZCodec2::MAX_MATCH, end - pos) - 4 ;
814+ const int maxMatch = min (ROLZCodec2::MAX_MATCH, end - pos) - 8 ;
815815
816816 // Check all recorded positions
817817 for (int i = counter; i > counter - _posChecks; i--) {
@@ -829,14 +829,14 @@ int ROLZCodec2::findMatch(const byte buf[], int pos, int end, uint32 key)
829829 int n = 0 ;
830830
831831 while (n < maxMatch) {
832- const int32 diff = LittleEndian::readInt32 (&buf[ref + n]) ^ LittleEndian::readInt32 (&curBuf[n]);
832+ const int64 diff = LittleEndian::readLong64 (&buf[ref + n]) ^ LittleEndian::readLong64 (&curBuf[n]);
833833
834834 if (diff != 0 ) {
835- n += (Global::trailingZeros (uint32 (diff)) >> 3 );
835+ n += (Global::trailingZeros (uint64 (diff)) >> 3 );
836836 break ;
837837 }
838838
839- n += 4 ;
839+ n += 8 ;
840840 }
841841
842842 if (n > bestLen) {
0 commit comments