summary refs log tree commit diff stats
path: root/tests/misc
diff options
context:
space:
mode:
authorOscar NihlgÄrd <oscarnihlgard@gmail.com>2019-05-25 20:48:13 +0200
committerAndreas Rumpf <rumpf_a@web.de>2019-05-25 20:48:13 +0200
commit3a06022071d3ecf62c8e2f4812062e2e2fe71954 (patch)
treeb565dbc9ab69e92ab9d0d7bff26b1a9acf8b75b3 /tests/misc
parent70fb3a93e9b051b2ba91769a43d63251d0d7a5b3 (diff)
downloadNim-3a06022071d3ecf62c8e2f4812062e2e2fe71954.tar.gz
Enable range checking for unsigned integers (#11313)
* Enable range checking for unsigned integers

* Make the tests green
Diffstat (limited to 'tests/misc')
-rw-r--r--tests/misc/tsizeof3.nim2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/misc/tsizeof3.nim b/tests/misc/tsizeof3.nim
index 50ad88371..e41e0a268 100644
--- a/tests/misc/tsizeof3.nim
+++ b/tests/misc/tsizeof3.nim
@@ -13,7 +13,7 @@ proc toByteArrayBE*[T: SomeInteger](num: T): ByteArrayBE[sizeof(T)]=
   ## Notice the result type
   const N = T.sizeof
   for i in 0 ..< N:
-    result[i] = byte(num shr ((N-1-i) * 8))
+    result[i] = byte((num shr ((N-1-i) * 8)) and high(int8))
 
 let a = 12345.toByteArrayBE
 echo a[^2 .. ^1] # to make it work on both 32-bit and 64-bit