OSDN Git Service

avcodec/huffyuvdsp: use an actual unsigned long constant
authorJames Almer <jamrial@gmail.com>
Mon, 6 Feb 2017 22:57:30 +0000 (19:57 -0300)
committerJames Almer <jamrial@gmail.com>
Sun, 19 Feb 2017 15:27:06 +0000 (12:27 -0300)
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
libavcodec/huffyuvdsp.c

index 759ffda..e770923 100644 (file)
 #include "mathops.h"
 #include "huffyuvdsp.h"
 
+// 0x00010001 or 0x0001000100010001 or whatever, depending on the cpu's native arithmetic size
+#define pw_1 (ULONG_MAX / UINT16_MAX)
+
 static void add_int16_c(uint16_t *dst, const uint16_t *src, unsigned mask, int w){
     long i;
-    unsigned long pw_lsb = (mask >> 1) * 0x0001000100010001ULL;
-    unsigned long pw_msb = pw_lsb +  0x0001000100010001ULL;
+    unsigned long pw_lsb = (mask >> 1) * pw_1;
+    unsigned long pw_msb = pw_lsb +  pw_1;
     for (i = 0; i <= w - (int)sizeof(long)/2; i += sizeof(long)/2) {
         long a = *(long*)(src+i);
         long b = *(long*)(dst+i);