Hi, On Sun, Jul 22, 2012 at 8:17 AM, Måns Rullgård <m...@mansr.com> wrote: > "Ronald S. Bultje" <rsbul...@gmail.com> writes: > >>> This manner of splitting things is incredibly weird-looking. Instead of >>> trying to unify these rather different fragments, turning the second >>> half of the loop into a macro and writing out separate loops, each >>> calling the macro for the common part, would probably look much more >>> sane. >> >> #define LOOP_COMMON_PART \ >> if (i + 2 < length && src[i + 1] == 0 && src[i + 2] <= 3) { \ >> if (src[i + 2] != 3) { \ >> /* startcode, so we must be past the end */ \ >> length = i; \ >> } \ >> break; \ >> } >> #if HAVE_FAST_UNALIGNED >> #define CHECK_COMMON_PART \ >> if (i > 0 && !src[i]) \ >> i--; \ >> while (src[i]) \ >> i++ >> #if HAVE_FAST_64BIT >> for (i = 0; i + 1 < length; i += 9) { >> if (!((~AV_RN64A(src + i) & >> (AV_RN64A(src + i) - 0x0100010001000101ULL)) & >> 0x8000800080008080ULL)) >> continue; >> CHECK_COMMON_PART; >> LOOP_COMMON_PART; >> i -= 7; >> } >> #else >> for (i = 0; i + 1 < length; i += 5) { >> if (!((~AV_RN32A(src + i) & >> (AV_RN32A(src + i) - 0x01000101U)) & >> 0x80008080U)) >> continue; >> CHECK_COMMON_PART; >> LOOP_COMMON_PART; >> i -= 3; >> } >> #endif >> #else >> for (i = 0; i + 1 < length; i += 2) { >> if (src[i]) >> continue; >> if (i > 0 && src[i - 1] == 0) >> i--; >> LOOP_COMMON_PART; >> } >> #endif > > With a bit saner names for the macros, this is way more readable.
Given the risk of having to send the patch 10x, why don't you guys suggest some names to make review shorter? Ronald _______________________________________________ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel