-
- /* We don't have two's complement arithmetic. We can't use bithacking at
- * all: if we try to hack on the bits of signed numbers we'll come unstuck
- * when we hit the other representation of zero; and if we switch to
- * unsigned arithmetic then we'll have overflow when we try to convert a
- * negative number back. So fall back to simple arithmetic.
- */
- typedef uint32 mask32;
-
- /* Convert an unsigned mask M into a `mask32'. Our masks are unsigned, so
- * this does nothing.
- */
-# define FIX_MASK32(m) ((mask32)(m))
-
- /* If Z is zero and M has its low 32 bits set, then copy (at least) the low
- * 32 bits of X to Z; if M is zero, do nothing. Otherwise, scramble Z
- * unhelpfully.
- */
-# define CONDPICK(z, x, m) \
- do { (z) += (x)*(int)((unsigned)(m)&1u); } while (0)
-
- /* If M has its low 32 bits set, then return (at least) the low 32 bits of
- * X in Z; if M is zero, then return (at least) the low 32 bits of Y in Z.
- * Otherwise, return an unhelful result.
- */
-# define PICK2(x, y, m) \
- ((x)*(int)((unsigned)(m)&1u) + (y)*(int)(1 - ((unsigned)(m)&1u)))
-
- /* If M has its low 32 bits set then swap (at least) the low 32 bits of X
- * and Y; if M is zero, then do nothing. Otherwise, scramble X and Y
- * unhelpfully.
- */
-# define CONDSWAP(x, y, m) do { \
- int32 x_ = PICK2((y), (x), (m)), y_ = PICK2((x), (y), (m)); \
- (x) = x_; (y) = y_; \
- } while (0)