on master help sign in
Fix generation of code points like \u{00A5}

Was producing them backwards and was shifting by too much

commitff0a99e99b1eac90f5bc12bfefe082a0e2544e37 authorEvan Czaplicki <evancz@users.noreply.github.com> dateMon 16 Apr 2018, 12:02 (9 years ago) parent734f1ad
1 file changed+4−4
compiler/src/Parse/Primitives/Utf8.hs+4−4
compiler/src/Parse/Primitives/Utf8.hs+4−4
@@ -318,17 +318,17 @@ wordToBits :: Int -> [Char]
318318wordToBits code =
319319 [ '\\' -- 0x5C -- \
320320 , 'u' -- 0x75 -- u
321− , toBits code 0
321+ , toBits code 12
322322 , toBits code 8
323− , toBits code 16
324− , toBits code 24
323+ , toBits code 4
324+ , toBits code 0
325325 ]
326326
327327
328328toBits :: Int -> Int -> Char
329329toBits code offset =
330330 let !n = fromIntegral (shiftR code offset .&. 0x000F) in
331− Char.chr $ if n < 10 then 0x30 + n else 0x41 + (n - 10)
331+ Char.chr $ if n < 10 then 0x30 + n else 0x61 + (n - 10)
332332
333333
334334{-# NOINLINE singleQuoteBits #-}