chiark / gitweb /
progs/..., symm/...: Fix 32-bit right-shift idiom.
[catacomb] / progs / cookie.c
index 6239eb0c62dc023430d66c6be790a619b7130241..c6912ffd39541a4f04ddfb43ad5bd059a540d5bc 100644 (file)
@@ -80,7 +80,7 @@ typedef struct cookie {
   octet *_p = (octet *)(p);                                            \
   const cookie *_c = (c);                                              \
   STORE32(_p + 0, _c->k);                                              \
-  STORE32(_p + 4, ((_c->exp & ~MASK32) >> 16) >> 16);                  \
+  STORE32(_p + 4, ((_c->exp & ~(unsigned long)MASK32) >> 16) >> 16);   \
   STORE32(_p + 8, _c->exp);                                            \
 } while (0)
 
@@ -97,7 +97,8 @@ typedef struct cookie {
   cookie *_c = (c);                                                    \
   const octet *_p = (const octet *)(p);                                        \
   _c->k = LOAD32(_p + 0);                                              \
-  _c->exp = ((time_t)(((LOAD32(_p + 4) << 16) << 16) & ~MASK32) |      \
+  _c->exp = ((time_t)(((LOAD32(_p + 4) << 16) << 16) &                 \
+                     ~(unsigned long)MASK32) |                         \
             (time_t)LOAD32(_p + 8));                                   \
 } while (0)