mirror of
https://github.com/google/brotli.git
synced 2024-11-21 19:20:09 +00:00
Hoist the static bounds check out of the combined if check.
PiperOrigin-RevId: 639054702
This commit is contained in:
parent
fe754f3459
commit
a528bce9f6
@ -192,8 +192,10 @@ static BROTLI_INLINE void FN(FindLongestMatch)(
|
|||||||
}
|
}
|
||||||
prev_ix &= ring_buffer_mask;
|
prev_ix &= ring_buffer_mask;
|
||||||
|
|
||||||
if (cur_ix_masked + best_len > ring_buffer_mask ||
|
if (cur_ix_masked + best_len > ring_buffer_mask) {
|
||||||
prev_ix + best_len > ring_buffer_mask ||
|
break;
|
||||||
|
}
|
||||||
|
if (prev_ix + best_len > ring_buffer_mask ||
|
||||||
data[cur_ix_masked + best_len] != data[prev_ix + best_len]) {
|
data[cur_ix_masked + best_len] != data[prev_ix + best_len]) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -239,8 +241,10 @@ static BROTLI_INLINE void FN(FindLongestMatch)(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
prev_ix &= ring_buffer_mask;
|
prev_ix &= ring_buffer_mask;
|
||||||
if (cur_ix_masked + best_len > ring_buffer_mask ||
|
if (cur_ix_masked + best_len > ring_buffer_mask) {
|
||||||
prev_ix + best_len > ring_buffer_mask ||
|
break;
|
||||||
|
}
|
||||||
|
if (prev_ix + best_len > ring_buffer_mask ||
|
||||||
/* compare 4 bytes ending at best_len + 1 */
|
/* compare 4 bytes ending at best_len + 1 */
|
||||||
BrotliUnalignedRead32(&data[cur_ix_masked + best_len - 3]) !=
|
BrotliUnalignedRead32(&data[cur_ix_masked + best_len - 3]) !=
|
||||||
BrotliUnalignedRead32(&data[prev_ix + best_len - 3])) {
|
BrotliUnalignedRead32(&data[prev_ix + best_len - 3])) {
|
||||||
|
@ -209,8 +209,10 @@ static BROTLI_INLINE void FN(FindLongestMatch)(
|
|||||||
}
|
}
|
||||||
prev_ix &= ring_buffer_mask;
|
prev_ix &= ring_buffer_mask;
|
||||||
|
|
||||||
if (cur_ix_masked + best_len > ring_buffer_mask ||
|
if (cur_ix_masked + best_len > ring_buffer_mask) {
|
||||||
prev_ix + best_len > ring_buffer_mask ||
|
break;
|
||||||
|
}
|
||||||
|
if (prev_ix + best_len > ring_buffer_mask ||
|
||||||
data[cur_ix_masked + best_len] != data[prev_ix + best_len]) {
|
data[cur_ix_masked + best_len] != data[prev_ix + best_len]) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -263,8 +265,10 @@ static BROTLI_INLINE void FN(FindLongestMatch)(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
prev_ix &= ring_buffer_mask;
|
prev_ix &= ring_buffer_mask;
|
||||||
if (cur_ix_masked + best_len > ring_buffer_mask ||
|
if (cur_ix_masked + best_len > ring_buffer_mask) {
|
||||||
prev_ix + best_len > ring_buffer_mask ||
|
break;
|
||||||
|
}
|
||||||
|
if (prev_ix + best_len > ring_buffer_mask ||
|
||||||
/* compare 4 bytes ending at best_len + 1 */
|
/* compare 4 bytes ending at best_len + 1 */
|
||||||
BrotliUnalignedRead32(&data[cur_ix_masked + best_len - 3]) !=
|
BrotliUnalignedRead32(&data[cur_ix_masked + best_len - 3]) !=
|
||||||
BrotliUnalignedRead32(&data[prev_ix + best_len - 3])) {
|
BrotliUnalignedRead32(&data[prev_ix + best_len - 3])) {
|
||||||
|
@ -192,8 +192,10 @@ static BROTLI_INLINE void FN(FindLongestMatch)(
|
|||||||
}
|
}
|
||||||
prev_ix &= ring_buffer_mask;
|
prev_ix &= ring_buffer_mask;
|
||||||
|
|
||||||
if (cur_ix_masked + best_len > ring_buffer_mask ||
|
if (cur_ix_masked + best_len > ring_buffer_mask) {
|
||||||
prev_ix + best_len > ring_buffer_mask ||
|
break;
|
||||||
|
}
|
||||||
|
if (prev_ix + best_len > ring_buffer_mask ||
|
||||||
data[cur_ix_masked + best_len] != data[prev_ix + best_len]) {
|
data[cur_ix_masked + best_len] != data[prev_ix + best_len]) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -234,8 +236,10 @@ static BROTLI_INLINE void FN(FindLongestMatch)(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
prev_ix &= ring_buffer_mask;
|
prev_ix &= ring_buffer_mask;
|
||||||
if (cur_ix_masked + best_len > ring_buffer_mask ||
|
if (cur_ix_masked + best_len > ring_buffer_mask) {
|
||||||
prev_ix + best_len > ring_buffer_mask ||
|
break;
|
||||||
|
}
|
||||||
|
if (prev_ix + best_len > ring_buffer_mask ||
|
||||||
/* compare 4 bytes ending at best_len + 1 */
|
/* compare 4 bytes ending at best_len + 1 */
|
||||||
BrotliUnalignedRead32(&data[cur_ix_masked + best_len - 3]) !=
|
BrotliUnalignedRead32(&data[cur_ix_masked + best_len - 3]) !=
|
||||||
BrotliUnalignedRead32(&data[prev_ix + best_len - 3])) {
|
BrotliUnalignedRead32(&data[prev_ix + best_len - 3])) {
|
||||||
|
@ -184,8 +184,10 @@ static BROTLI_INLINE void FN(FindLongestMatch)(
|
|||||||
}
|
}
|
||||||
prev_ix &= ring_buffer_mask;
|
prev_ix &= ring_buffer_mask;
|
||||||
|
|
||||||
if (cur_ix_masked + best_len > ring_buffer_mask ||
|
if (cur_ix_masked + best_len > ring_buffer_mask) {
|
||||||
prev_ix + best_len > ring_buffer_mask ||
|
break;
|
||||||
|
}
|
||||||
|
if (prev_ix + best_len > ring_buffer_mask ||
|
||||||
data[cur_ix_masked + best_len] != data[prev_ix + best_len]) {
|
data[cur_ix_masked + best_len] != data[prev_ix + best_len]) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -235,8 +237,10 @@ static BROTLI_INLINE void FN(FindLongestMatch)(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
prev_ix &= ring_buffer_mask;
|
prev_ix &= ring_buffer_mask;
|
||||||
if (cur_ix_masked + best_len > ring_buffer_mask ||
|
if (cur_ix_masked + best_len > ring_buffer_mask) {
|
||||||
prev_ix + best_len > ring_buffer_mask ||
|
break;
|
||||||
|
}
|
||||||
|
if (prev_ix + best_len > ring_buffer_mask ||
|
||||||
/* compare 4 bytes ending at best_len + 1 */
|
/* compare 4 bytes ending at best_len + 1 */
|
||||||
BrotliUnalignedRead32(&data[cur_ix_masked + best_len - 3]) !=
|
BrotliUnalignedRead32(&data[cur_ix_masked + best_len - 3]) !=
|
||||||
BrotliUnalignedRead32(&data[prev_ix + best_len - 3])) {
|
BrotliUnalignedRead32(&data[prev_ix + best_len - 3])) {
|
||||||
|
Loading…
Reference in New Issue
Block a user