FIX BUILD (on Windows): follow changes to make threaded RTS compile with -fasm
[ghc-hetmet.git] / includes / Stg.h
index 8e3da0f..1facd5f 100644 (file)
@@ -66,7 +66,9 @@
 #define BITS_IN(x) (BITS_PER_BYTE * sizeof(x))
 
 /*
- * 'Portable' inlining
+ * 'Portable' inlining:
+ * INLINE_HEADER is for inline functions in header files
+ * STATIC_INLINE is for inline functions in source files
  */
 #if defined(__GNUC__) || defined( __INTEL_COMPILER)
 # define INLINE_HEADER static inline
@@ -442,7 +444,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)                     \