Fix int64ToInteger 0xFFFFFFFF00000000 on 32bit machine; trac #2223
authorIan Lynagh <igloo@earth.li>
Thu, 24 Apr 2008 13:15:26 +0000 (13:15 +0000)
committerIan Lynagh <igloo@earth.li>
Thu, 24 Apr 2008 13:15:26 +0000 (13:15 +0000)
Patch from Mike Gunter.

rts/PrimOps.cmm

index cbdfe67..6c3593e 100644 (file)
@@ -452,11 +452,11 @@ int64ToIntegerzh_fast
    hi = TO_W_(val >> 32);
    lo = TO_W_(val);
 
-   if ( hi != 0 && hi != 0xFFFFFFFF )  { 
-       words_needed = 2;
-   } else { 
+   if ( hi == 0 || (hi == 0xFFFFFFFF && lo != 0) )  {
        // minimum is one word
        words_needed = 1;
+   } else { 
+       words_needed = 2;
    }
 
    ALLOC_PRIM( SIZEOF_StgArrWords + WDS(words_needed),