Make reg031 char-sign-indifferent.
commit531c9d56dad746d2ea3930c089ec10a8a9e6dc4b
authorMatus Tejiscak <ziman@functor.sk>
dateSun 19 Jan 2014, 22:05 (13 years ago)
parent0877929
test/reg031/expected+1−1
@@ -1 +1 @@
1−[10, -128, -55, -1, 10, 51, 10, 52]
1+[10, 128, 201, 255, 10, 51, 10, 52]
test/reg031/reg031.idr+5−1
@@ -1,4 +1,8 @@
11module Main
22
33main : IO ()
4−main = print . map ord . unpack $ "\x0a\x80\xC9\xFF\n3\n4"
4+main = print . map val . unpack $ "\x0a\x80\xC9\xFF\n3\n4"
5+ where
6+ -- make the values positive if the backend has signed chars
7+ val : Char -> Int
8+ val = flip mod 256 . (+256) . ord