#2223: Int64.toInteger
-------------------------------+--------------------------------------------
Reporter: gnezdo | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Runtime System | Version: 6.8.2
Severity: major | Resolution:
Keywords: | Testcase:
Architecture: x86 | Os: Linux
-------------------------------+--------------------------------------------
Comment (by wolfgang):
Yes, my code was wrong.
I think your code still leaves out most corner cases:
Consider 0xFFFFFFFF00000001, or 0x0000000080000000.
If the high word is 0 of -1 , and the sign bit of the low word matches
that, THEN one word is enough.
So I would recommend the following (untested):
{{{
if ( (hi == 0 && %ge( lo, 0 )) || (hi == 0xFFFFFFFF && %lt(lo,
0) ) {
words_needed = 1;
// minimum is one word
} else {
words_needed = 2;
}
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2223#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs