@@ -44,18 +44,15 @@ data AlexAddr = AlexA# Addr#
44
44
{-# INLINE alexIndexInt16OffAddr #-}
45
45
alexIndexInt16OffAddr :: AlexAddr -> Int # -> Int #
46
46
alexIndexInt16OffAddr (AlexA # arr) off =
47
- #ifdef WORDS_BIGENDIAN
48
- narrow16Int# i
49
- where
50
- i = word2Int# ((high `uncheckedShiftL# ` 8 # ) `or # ` low)
51
- high = int2Word# (ord# (indexCharOffAddr# arr (off' +# 1 # )))
52
- low = int2Word# (ord# (indexCharOffAddr# arr off'))
53
- off' = off *# 2 #
54
- #else
55
47
#if __GLASGOW_HASKELL__ >= 901
56
- GHC.Exts. int16ToInt#
48
+ GHC.Exts. int16ToInt# -- qualified import because it doesn't exist on older GHC's
57
49
#endif
58
- (indexInt16OffAddr# arr off)
50
+ #ifdef WORDS_BIGENDIAN
51
+ (GHC.Exts. word16ToInt16# (GHC.Exts. wordToWord16# (GHC.Exts. byteSwap16# (GHC.Exts. word16ToWord# (GHC.Exts. int16ToWord16#
52
+ #endif
53
+ (indexInt16OffAddr# arr off)
54
+ #ifdef WORDS_BIGENDIAN
55
+ )))))
59
56
#endif
60
57
#else
61
58
alexIndexInt16OffAddr = (Data.Array. !)
@@ -65,22 +62,15 @@ alexIndexInt16OffAddr = (Data.Array.!)
65
62
{-# INLINE alexIndexInt32OffAddr #-}
66
63
alexIndexInt32OffAddr :: AlexAddr -> Int # -> Int #
67
64
alexIndexInt32OffAddr (AlexA # arr) off =
68
- #ifdef WORDS_BIGENDIAN
69
- narrow32Int# i
70
- where
71
- i = word2Int# ((b3 `uncheckedShiftL# ` 24 # ) `or # `
72
- (b2 `uncheckedShiftL# ` 16 # ) `or # `
73
- (b1 `uncheckedShiftL# ` 8 # ) `or # ` b0)
74
- b3 = int2Word# (ord# (indexCharOffAddr# arr (off' +# 3 # )))
75
- b2 = int2Word# (ord# (indexCharOffAddr# arr (off' +# 2 # )))
76
- b1 = int2Word# (ord# (indexCharOffAddr# arr (off' +# 1 # )))
77
- b0 = int2Word# (ord# (indexCharOffAddr# arr off'))
78
- off' = off *# 4 #
79
- #else
80
65
#if __GLASGOW_HASKELL__ >= 901
81
- GHC.Exts. int32ToInt#
66
+ GHC.Exts. int32ToInt# -- qualified import because it doesn't exist on older GHC's
82
67
#endif
83
- (indexInt32OffAddr# arr off)
68
+ #ifdef WORDS_BIGENDIAN
69
+ (GHC.Exts. word32ToInt32# (GHC.Exts. wordToWord32# (GHC.Exts. byteSwap32# (GHC.Exts. word32ToWord# (GHC.Exts. int32ToWord32#
70
+ #endif
71
+ (indexInt32OffAddr# arr off)
72
+ #ifdef WORDS_BIGENDIAN
73
+ )))))
84
74
#endif
85
75
#else
86
76
alexIndexInt32OffAddr = (Data.Array. !)
0 commit comments