# HG changeset patch # User reimar # Date 1238508294 0 # Node ID 2ae6ab3fa3ba7f150315b212a5819d9696b7f65c # Parent 0469949a522482e3a15731d846fe2bb067fd63c1 Rearrange how the different cases are checked to reduce the number of comparisons and allow further simplifications. diff -r 0469949a5224 -r 2ae6ab3fa3ba interplayvideo.c --- a/interplayvideo.c Tue Mar 31 13:58:40 2009 +0000 +++ b/interplayvideo.c Tue Mar 31 14:04:54 2009 +0000 @@ -386,7 +386,8 @@ memcpy(P, s->stream_ptr, 4); s->stream_ptr += 4; - if ((P[0] <= P[1]) && (P[2] <= P[3])) { + if (P[0] <= P[1]) { + if (P[2] <= P[3]) { /* 1 of 4 colors for each pixel, need 16 more bytes */ CHECK_STREAM_PTR(16); @@ -400,7 +401,7 @@ s->pixel_ptr += s->line_inc; } - } else if ((P[0] <= P[1]) && (P[2] > P[3])) { + } else { uint32_t flags; /* 1 of 4 colors for each 2x2 block, need 4 more bytes */ @@ -418,7 +419,9 @@ s->pixel_ptr += s->stride * 2; } - } else if ((P[0] > P[1]) && (P[2] <= P[3])) { + } + } else { + if (P[2] <= P[3]) { uint64_t flags; /* 1 of 4 colors for each 2x1 block, need 8 more bytes */ @@ -432,8 +435,7 @@ } s->pixel_ptr += s->stride; } - - } else { + } else { uint64_t flags; /* 1 of 4 colors for each 1x2 block, need 8 more bytes */ @@ -447,6 +449,7 @@ } s->pixel_ptr += s->stride * 2; } + } } /* report success */