diff options
author | Bruce Momjian | 2005-05-25 21:40:43 +0000 |
---|---|---|
committer | Bruce Momjian | 2005-05-25 21:40:43 +0000 |
commit | b492c3acccb3f8c97559ddfc2a25f25953a026d2 (patch) | |
tree | a9c42aa2bd86a88a849ffaa005766ffe3dee762a /src/port/crypt.c | |
parent | 13b729ca5267b58005f1ca9c873a86c2b0db3591 (diff) |
Add parentheses to macros when args are used in computations. Without
them, the executation behavior could be unexpected.
Diffstat (limited to 'src/port/crypt.c')
-rw-r--r-- | src/port/crypt.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/port/crypt.c b/src/port/crypt.c index 7d0f14a6d10..2c71be98a94 100644 --- a/src/port/crypt.c +++ b/src/port/crypt.c @@ -740,7 +740,7 @@ int num_iter; { #define SPTAB(t, i) \ - (*(int32_t *)((unsigned char *)t + i*(sizeof(int32_t)/4))) + (*(int32_t *)((unsigned char *)(t) + (i)*(sizeof(int32_t)/4))) #if defined(gould) /* use this if B.b[i] is evaluated just once ... */ #define DOXOR(x,y,i) x^=SPTAB(SPE[0][i],B.b[i]); y^=SPTAB(SPE[1][i],B.b[i]); @@ -755,9 +755,9 @@ int num_iter; #endif #define CRUNCH(p0, p1, q0, q1) \ - k = (q0 ^ q1) & SALT; \ - B.b32.i0 = k ^ q0 ^ kp->b32.i0; \ - B.b32.i1 = k ^ q1 ^ kp->b32.i1; \ + k = ((q0) ^ (q1)) & SALT; \ + B.b32.i0 = k ^ (q0) ^ kp->b32.i0; \ + B.b32.i1 = k ^ (q1) ^ kp->b32.i1; \ kp = (C_block *)((char *)kp+ks_inc); \ \ DOXOR(p0, p1, 0); \ |