1 {-# OPTIONS -fno-implicit-prelude #-}
8 eftCharFB c n x y = go x
11 | otherwise = C# (chr# x) `c` go (x +# 1#)
14 eftIntFB c n x y | x ># y = n
17 go x = I# x `c` if x ==# y then n else go (x +# 1#)
19 eftIntList x y | x ># y = []
22 go x = I# x : if x ==# y then [] else go (x +# 1#)
26 | delta >=# 0# = go_up_char_fb c n x1 delta 255#
27 | otherwise = go_dn_char_fb c n x1 delta 0#
32 | delta >=# 0# = go_up_char_list x1 delta 255#
33 | otherwise = go_dn_char_list x1 delta 0#
37 efdtCharFB c n x1 x2 lim
38 | delta >=# 0# = go_up_char_fb c n x1 delta lim
39 | otherwise = go_dn_char_fb c n x1 delta lim
43 efdtCharList x1 x2 lim
44 | delta >=# 0# = go_up_char_list x1 delta lim
45 | otherwise = go_dn_char_list x1 delta lim
49 go_up_char_fb c n x delta lim
52 go_up x | x ># lim = n
53 | otherwise = C# (chr# x) `c` go_up (x +# delta)
55 go_dn_char_fb c n x delta lim
58 go_dn x | x <# lim = n
59 | otherwise = C# (chr# x) `c` go_dn (x +# delta)
61 go_up_char_list x delta lim
64 go_up x | x ># lim = []
65 | otherwise = C# (chr# x) : go_up (x +# delta)
68 go_dn_char_list x delta lim
71 go_dn x | x <# lim = []
72 | otherwise = C# (chr# x) : go_dn (x +# delta)
75 | delta >=# 0# = if x1 ># y then n else go_up_int_fb c n x1 delta lim
76 | otherwise = if x1 <# y then n else go_dn_int_fb c n x1 delta lim
82 | delta >=# 0# = if x1 ># y then [] else go_up_int_list x1 delta lim
83 | otherwise = if x1 <# y then [] else go_dn_int_list x1 delta lim
89 | delta >=# 0# = go_up_int_fb c n x1 delta ( 2147483647# -# delta)
90 | otherwise = go_dn_int_fb c n x1 delta ((-2147483648#) -# delta)
95 | delta >=# 0# = go_up_int_list x1 delta ( 2147483647# -# delta)
96 | otherwise = go_dn_int_list x1 delta ((-2147483648#) -# delta)
100 -- In all of these, the (x +# delta) is guaranteed not to overflow
102 go_up_int_fb c n x delta lim
105 go_up x | x ># lim = I# x `c` n
106 | otherwise = I# x `c` go_up (x +# delta)
108 go_dn_int_fb c n x delta lim
111 go_dn x | x <# lim = I# x `c` n
112 | otherwise = I# x `c` go_dn (x +# delta)
114 go_up_int_list x delta lim
117 go_up x | x ># lim = [I# x]
118 | otherwise = I# x : go_up (x +# delta)
120 go_dn_int_list x delta lim
123 go_dn x | x <# lim = [I# x]
124 | otherwise = I# x : go_dn (x +# delta)
127 efdtInt = efdtIntList