+#ifdef HAVE_UINT64
+
+# define LOAD64_B(p) \
+ (((uint64)GETBYTE((p), 0) << 56) | \
+ ((uint64)GETBYTE((p), 1) << 48) | \
+ ((uint64)GETBYTE((p), 2) << 40) | \
+ ((uint64)GETBYTE((p), 3) << 32) | \
+ ((uint64)GETBYTE((p), 4) << 24) | \
+ ((uint64)GETBYTE((p), 5) << 16) | \
+ ((uint64)GETBYTE((p), 6) << 8) | \
+ ((uint64)GETBYTE((p), 7) << 0))
+# define LOAD64_L(p) \
+ (((uint64)GETBYTE((p), 0) << 0) | \
+ ((uint64)GETBYTE((p), 1) << 8) | \
+ ((uint64)GETBYTE((p), 2) << 16) | \
+ ((uint64)GETBYTE((p), 3) << 24) | \
+ ((uint64)GETBYTE((p), 4) << 32) | \
+ ((uint64)GETBYTE((p), 5) << 40) | \
+ ((uint64)GETBYTE((p), 6) << 48) | \
+ ((uint64)GETBYTE((p), 7) << 56))
+# define LOAD64(p) LOAD64_B((p))
+# define LOAD64_B_(d, p) ((d).i = LOAD64_B((p)))
+# define LOAD64_L_(d, p) ((d).i = LOAD64_L((p)))
+# define LOAD64_(d, p) LOAD64_B_((d), (p))
+
+# define STORE64_B(p, v) \
+ (PUTBYTE((p), 0, (uint64)(v) >> 56), \
+ PUTBYTE((p), 1, (uint64)(v) >> 48), \
+ PUTBYTE((p), 2, (uint64)(v) >> 40), \
+ PUTBYTE((p), 3, (uint64)(v) >> 32), \
+ PUTBYTE((p), 4, (uint64)(v) >> 24), \
+ PUTBYTE((p), 5, (uint64)(v) >> 16), \
+ PUTBYTE((p), 6, (uint64)(v) >> 8), \
+ PUTBYTE((p), 7, (uint64)(v) >> 0))
+# define STORE64_L(p, v) \
+ (PUTBYTE((p), 0, (uint64)(v) >> 0), \
+ PUTBYTE((p), 1, (uint64)(v) >> 8), \
+ PUTBYTE((p), 2, (uint64)(v) >> 16), \
+ PUTBYTE((p), 3, (uint64)(v) >> 24), \
+ PUTBYTE((p), 4, (uint64)(v) >> 32), \
+ PUTBYTE((p), 5, (uint64)(v) >> 40), \
+ PUTBYTE((p), 6, (uint64)(v) >> 48), \
+ PUTBYTE((p), 7, (uint64)(v) >> 56))
+# define STORE64(p, v) STORE64_B((p), (v))
+# define STORE64_B_(p, v) STORE64_B((p), (v).i)
+# define STORE64_L_(p, v) STORE64_L((p), (v).i)
+# define STORE64_(p, v) STORE64_B_((p), (v))
+
+#else
+
+# define LOAD64_B_(d, p) \
+ ((d).hi = LOAD32_B((octet *)(p) + 0), \
+ (d).lo = LOAD32_B((octet *)(p) + 4))
+# define LOAD64_L_(d, p) \
+ ((d).lo = LOAD32_L((octet *)(p) + 0), \
+ (d).hi = LOAD32_L((octet *)(p) + 4))
+# define LOAD64_(d, p) LOAD64_B_((d), (p))
+
+# define STORE64_B_(p, v) \
+ (STORE32_B((octet *)(p) + 0, (v).hi), \
+ STORE32_B((octet *)(p) + 4, (v).lo))
+# define STORE64_L_(p, v) \
+ (STORE32_L((octet *)(p) + 0, (v).lo), \
+ STORE32_L((octet *)(p) + 4, (v).hi))
+# define STORE64_(p, v) STORE64_B_((p), (v))
+
+#endif
+
+/* --- Other operations on 64-bit integers --- */
+
+#ifdef HAVE_UINT64
+# define SET64(d, h, l) ((d).i = (U64((h)) << 32) | U64((l)))
+# define ASSIGN64(d, x) ((d).i = U64((x)))
+# define HI64(x) U32((x).i >> 32)
+# define LO64(x) U32((x).i)
+# define GET64(t, x) ((t)(x).i)
+#else
+# define SET64(d, h, l) ((d).hi = U32(h), (d).lo = U32(l))
+# define ASSIGN64(d, x) \
+ ((d).hi = ((x & ~MASK32) >> 16) >> 16, (d).lo = U32(x))
+# define HI64(x) U32((x).hi)
+# define LO64(x) U32((x).lo)
+# define GET64(t, x) (((((t)HI64(x) << 16) << 16) & ~MASK32) | (t)LO64(x))
+#endif
+
+#ifdef HAVE_UINT64
+# define AND64(d, x, y) ((d).i = (x).i & (y).i)
+# define OR64(d, x, y) ((d).i = (x).i | (y).i)
+# define XOR64(d, x, y) ((d).i = (x).i ^ (y).i)
+# define CPL64(d, x) ((d).i = ~(x).i)
+# define ADD64(d, x, y) ((d).i = (x).i + (y).i)
+# define SUB64(d, x, y) ((d).i = (x).i - (y).i)
+# define CMP64(x, op, y) ((x).i op (y).i)
+# define ZERO64(x) ((x) == 0)
+#else
+# define AND64(d, x, y) ((d).lo = (x).lo & (y).lo, (d).hi = (x).hi & (y).hi)
+# define OR64(d, x, y) ((d).lo = (x).lo | (y).lo, (d).hi = (x).hi | (y).hi)
+# define XOR64(d, x, y) ((d).lo = (x).lo ^ (y).lo, (d).hi = (x).hi ^ (y).hi)
+# define CPL64(d, x) ((d).lo = ~(x).lo, (d).hi = ~(x).hi)
+# define ADD64(d, x, y) do { \
+ uint32 _x = U32((x).lo + (y).lo); \
+ (d).hi = (x).hi + (y).hi + (_x < (x).lo); \
+ (d).lo = _x; \
+ } while (0)
+# define SUB64(d, x, y) do { \
+ uint32 _x = U32((x).lo - (y).lo); \
+ (d).hi = (x).hi - (y).hi - (_x > (x).lo); \
+ (d).lo = _x; \
+ } while (0)
+# define CMP64(x, op, y) \
+ ((x).hi == (y).hi ? (x).lo op (y).lo : (x).hi op (y).hi)
+# define ZERO64(x) ((x).lo == 0 && (x).hi == 0)
+#endif
+
+/* --- Storing integers in tables --- */
+
+#ifdef HAVE_UINT64
+# define X64(x, y) { 0x##x##y }
+#else
+# define X64(x, y) { 0x##x, 0x##y }
+#endif
+