From 8e905585c46e3bd2682996fad63509272c3a8ff6 Mon Sep 17 00:00:00 2001 From: simonmar Date: Tue, 25 May 2004 09:27:16 +0000 Subject: [PATCH] [project @ 2004-05-25 09:27:16 by simonmar] Small performance hack in maxBound::Word. --- GHC/Word.hs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/GHC/Word.hs b/GHC/Word.hs index 5a13fd0..b703782 100644 --- a/GHC/Word.hs +++ b/GHC/Word.hs @@ -132,12 +132,15 @@ instance Integral Word where instance Bounded Word where minBound = 0 + + -- use unboxed literals for maxBound, because GHC doesn't optimise + -- (fromInteger 0xffffffff :: Word). #if WORD_SIZE_IN_BITS == 31 - maxBound = 0x7FFFFFFF + maxBound = W# (int2Word# 0x7FFFFFFF#) #elif WORD_SIZE_IN_BITS == 32 - maxBound = 0xFFFFFFFF + maxBound = W# (int2Word# 0xFFFFFFFF#) #else - maxBound = 0xFFFFFFFFFFFFFFFF + maxBound = W# (int2Word# 0xFFFFFFFFFFFFFFFF#) #endif instance Ix Word where -- 1.7.10.4