Skip to content

Commit 104bf45

Browse files
committed
Fix bug in the 9.2 case
I did get lost in the ifdefs, I'm afraid
1 parent f956dbc commit 104bf45

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

templates/GenericTemplate.hs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,17 @@ ALEX_ENDIF
6161
alexIndexInt16OffAddr :: AlexAddr -> Int# -> Int#
6262
alexIndexInt16OffAddr (AlexA# arr) off =
6363
ALEX_IF_BIGENDIAN
64-
ALEX_IF_GHC_GT_901
6564
narrow16Int# i
66-
ALEX_ELSE
67-
int16ToInt# i
68-
ALEX_ENDIF
6965
where
7066
i = word2Int# ((high `uncheckedShiftL#` 8#) `or#` low)
7167
high = int2Word# (ord# (indexCharOffAddr# arr (off' +# 1#)))
7268
low = int2Word# (ord# (indexCharOffAddr# arr off'))
7369
off' = off *# 2#
7470
ALEX_ELSE
75-
indexInt16OffAddr# arr off
71+
ALEX_IF_GHC_GT_901
72+
int16ToInt#
73+
ALEX_ENDIF
74+
(indexInt16OffAddr# arr off)
7675
ALEX_ENDIF
7776
#else
7877
alexIndexInt16OffAddr arr off = arr ! off
@@ -83,11 +82,7 @@ alexIndexInt16OffAddr arr off = arr ! off
8382
alexIndexInt32OffAddr :: AlexAddr -> Int# -> Int#
8483
alexIndexInt32OffAddr (AlexA# arr) off =
8584
ALEX_IF_BIGENDIAN
86-
ALEX_IF_GHC_GT_901
8785
narrow32Int# i
88-
ALEX_ELSE
89-
int32ToInt# i
90-
ALEX_ENDIF
9186
where
9287
i = word2Int# ((b3 `uncheckedShiftL#` 24#) `or#`
9388
(b2 `uncheckedShiftL#` 16#) `or#`
@@ -98,7 +93,10 @@ ALEX_ENDIF
9893
b0 = int2Word# (ord# (indexCharOffAddr# arr off'))
9994
off' = off *# 4#
10095
ALEX_ELSE
101-
indexInt32OffAddr# arr off
96+
ALEX_IF_GHC_GT_901
97+
int32ToInt#
98+
ALEX_ENDIF
99+
(indexInt32OffAddr# arr off)
102100
ALEX_ENDIF
103101
#else
104102
alexIndexInt32OffAddr arr off = arr ! off

0 commit comments

Comments
 (0)