Rejig TABLES_NEXT_TO_CODE: the -unreg flag was broken by earlier changes
[ghc-hetmet.git] / includes / Stg.h
index a63b7ec..5cd3701 100644 (file)
@@ -127,8 +127,8 @@ typedef StgWord64       LW_;
 #define EF_(f)         extern F_ f(void)
 
 typedef StgWord StgWordArray[];
-#define EI_             extern StgWordArray
-#define II_             static StgWordArray
+#define EI_(X)          extern StgWordArray (X) GNU_ATTRIBUTE(aligned (8))
+#define II_(X)          static StgWordArray (X) GNU_ATTRIBUTE(aligned (8))
 
 /* -----------------------------------------------------------------------------
    Tail calls
@@ -442,7 +442,9 @@ typedef union {
 
 /* Approximate version when we don't have long arithmetic (on 64-bit archs) */
 
-#define HALF_POS_INT  (((I_)1) << (BITS_IN (I_) / 2))
+/* If we have n-bit words then we have n-1 bits after accounting for the
+ * sign bit, so we can fit the result of multiplying 2 (n-1)/2-bit numbers */
+#define HALF_POS_INT  (((I_)1) << ((BITS_IN (I_) - 1) / 2))
 #define HALF_NEG_INT  (-HALF_POS_INT)
 
 #define mulIntMayOflo(a,b)                     \