summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorcooldome <ariabushenko@gmail.com>2020-10-27 23:09:26 +0000
committerGitHub <noreply@github.com>2020-10-28 00:09:26 +0100
commitf8cac6bbbcfa8ddc649160945a17a6f5b7a4d9d6 (patch)
treebaaa743daba3e243d7c42fe8542e0336cfeb62a2 /compiler
parent0fb878324eeb39a4707be5ab0fd6ad8412950b78 (diff)
downloadNim-f8cac6bbbcfa8ddc649160945a17a6f5b7a4d9d6.tar.gz
fix #15752 (#15754)
Diffstat (limited to 'compiler')
-rw-r--r--compiler/sizealignoffsetimpl.nim8
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/sizealignoffsetimpl.nim b/compiler/sizealignoffsetimpl.nim
index 3e536f5d7..2c764fe12 100644
--- a/compiler/sizealignoffsetimpl.nim
+++ b/compiler/sizealignoffsetimpl.nim
@@ -277,14 +277,14 @@ proc computeSizeAlign(conf: ConfigRef; typ: PType) =
       typ.size = 4              # use signed int32
       typ.align = 4
     else:
-      let length = toInt64(lastOrd(conf, typ))   # BUGFIX: use lastOrd!
-      if length + 1 < `shl`(1, 8):
+      let lastOrd = toInt64(lastOrd(conf, typ))   # BUGFIX: use lastOrd!
+      if lastOrd < `shl`(1, 8):
         typ.size = 1
         typ.align = 1
-      elif length + 1 < `shl`(1, 16):
+      elif lastOrd < `shl`(1, 16):
         typ.size = 2
         typ.align = 2
-      elif length + 1 < `shl`(BiggestInt(1), 32):
+      elif lastOrd < `shl`(BiggestInt(1), 32):
         typ.size = 4
         typ.align = 4
       else: