diff options
author | Arne Döring <arne.doering@gmx.net> | 2019-02-12 22:00:31 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-02-13 23:30:14 +0100 |
commit | 28394153aba1e1ec0410406392e26e1e7e2e681e (patch) | |
tree | 0f2f455db7375b8e2c1e57b56a7f7d950d955bab | |
parent | 304b1dd34bc52df29528c2a12f769cb59904db5a (diff) | |
download | Nim-28394153aba1e1ec0410406392e26e1e7e2e681e.tar.gz |
32 bit fixes (#10608)
-rwxr-xr-x | bin/nim-gdb | 3 | ||||
-rw-r--r-- | build_all.sh | 1 | ||||
-rw-r--r-- | compiler/ast.nim | 9 | ||||
-rw-r--r-- | compiler/ccgexprs.nim | 5 | ||||
-rw-r--r-- | compiler/evaltempl.nim | 7 | ||||
-rw-r--r-- | compiler/pragmas.nim | 13 | ||||
-rw-r--r-- | compiler/semmagic.nim | 14 | ||||
-rw-r--r-- | compiler/semtempl.nim | 4 | ||||
-rw-r--r-- | compiler/suggest.nim | 2 | ||||
-rw-r--r-- | koch.nim | 3 | ||||
-rw-r--r-- | lib/pure/math.nim | 2 | ||||
-rw-r--r-- | testament/specs.nim | 3 | ||||
-rw-r--r-- | tests/concepts/texplain.nim | 12 | ||||
-rw-r--r-- | tests/converter/tgenericconverter2.nim | 36 | ||||
-rw-r--r-- | tests/enum/tenummix.nim | 4 | ||||
-rw-r--r-- | tests/errmsgs/tunknown_named_parameter.nim | 3 | ||||
-rw-r--r-- | tests/generics/trtree.nim | 2 | ||||
-rw-r--r-- | tests/misc/tradix.nim | 5 | ||||
-rw-r--r-- | tests/misc/tsizeof.nim | 30 | ||||
-rw-r--r-- | tests/objects/tobject3.nim | 28 | ||||
-rw-r--r-- | tests/stdlib/tosproc.nim | 8 | ||||
-rw-r--r-- | tests/system/t7894.nim | 1 | ||||
-rw-r--r-- | tests/system/talloc2.nim | 68 | ||||
-rw-r--r-- | tests/types/tfinalobj.nim | 20 | ||||
-rw-r--r-- | tests/vm/tvmops.nim | 5 | ||||
-rw-r--r-- | tests/vm/tzero_extend.nim | 12 |
26 files changed, 165 insertions, 135 deletions
diff --git a/bin/nim-gdb b/bin/nim-gdb index e7b41094d..9d6f462bb 100755 --- a/bin/nim-gdb +++ b/bin/nim-gdb @@ -3,6 +3,9 @@ # Exit if anything fails set -e +which nim > /dev/null || (echo "nim not in PATH"; exit 1) +which gdb > /dev/null || (echo "gdb not in PATH"; exit 1) + # Find out where the pretty printer Python module is NIM_SYSROOT=$(dirname $(dirname $(readlink -e $(which nim)))) GDB_PYTHON_MODULE_PATH="$NIM_SYSROOT/tools/nim-gdb.py" diff --git a/build_all.sh b/build_all.sh index 0706dcaf2..333814d62 100644 --- a/build_all.sh +++ b/build_all.sh @@ -27,7 +27,6 @@ build_nim_csources(){ [ -f $nim_csources ] || echo_run build_nim_csources # Note: if fails, may need to `cd csources && git pull` -# see D20190115T162028 echo_run bin/nim c --skipUserCfg --skipParentCfg koch echo_run ./koch boot -d:release diff --git a/compiler/ast.nim b/compiler/ast.nim index 3146722cb..fbe6132b3 100644 --- a/compiler/ast.nim +++ b/compiler/ast.nim @@ -271,6 +271,10 @@ type # language; for interfacing with Objective C sfDiscardable, # returned value may be discarded implicitly sfOverriden, # proc is overriden + sfCallSideLineinfo# A flag for template symbols to tell the + # compiler it should use line information from + # the calling side of the macro, not from the + # implementation. sfGenSym # symbol is 'gensym'ed; do not add to symbol table TSymFlags* = set[TSymFlag] @@ -1265,7 +1269,10 @@ proc `$`*(x: TLockLevel): string = else: result = $int16(x) proc `$`*(s: PSym): string = - result = s.name.s & "@" & $s.id + if s != nil: + result = s.name.s & "@" & $s.id + else: + result = "<nil>" proc newType*(kind: TTypeKind, owner: PSym): PType = new(result) diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim index fb2fd89a3..8ccca9813 100644 --- a/compiler/ccgexprs.nim +++ b/compiler/ccgexprs.nim @@ -1997,6 +1997,11 @@ proc genMagicExpr(p: BProc, e: PNode, d: var TLoc, op: TMagic) = of mSizeOf: let t = e.sons[1].typ.skipTypes({tyTypeDesc}) putIntoDest(p, d, e, "((NI)sizeof($1))" % [getTypeDesc(p.module, t)]) + of mAlignOf: + let t = e.sons[1].typ.skipTypes({tyTypeDesc}) + if not p.module.compileToCpp: + p.module.includeHeader("<stdalign.h>") + putIntoDest(p, d, e, "((NI)alignof($1))" % [getTypeDesc(p.module, t)]) of mChr: genSomeCast(p, e, d) of mOrd: genOrd(p, e, d) of mLengthArray, mHigh, mLengthStr, mLengthSeq, mLengthOpenArray: diff --git a/compiler/evaltempl.nim b/compiler/evaltempl.nim index 0f9220102..43c038270 100644 --- a/compiler/evaltempl.nim +++ b/compiler/evaltempl.nim @@ -186,9 +186,9 @@ proc evalTemplate*(n: PNode, tmpl, genSymOwner: PSym; renderTree(result, {renderNoComments})) else: result = copyNode(body) - #ctx.instLines = body.kind notin {nkStmtList, nkStmtListExpr, - # nkBlockStmt, nkBlockExpr} - #if ctx.instLines: result.info = n.info + ctx.instLines = sfCallSideLineinfo in tmpl.flags + if ctx.instLines: + result.info = n.info for i in countup(0, safeLen(body) - 1): evalTemplateAux(body.sons[i], args, ctx, result) result.flags.incl nfFromTemplate @@ -196,4 +196,3 @@ proc evalTemplate*(n: PNode, tmpl, genSymOwner: PSym; #if ctx.debugActive: # echo "instantion of ", renderTree(result, {renderIds}) dec(conf.evalTemplateCounter) - diff --git a/compiler/pragmas.nim b/compiler/pragmas.nim index fd721e1e5..b1063b682 100644 --- a/compiler/pragmas.nim +++ b/compiler/pragmas.nim @@ -803,12 +803,15 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: var int, of wSize: if sym.typ == nil: invalidPragma(c, it) var size = expectIntLit(c, it) - if not isPowerOfTwo(size) or size <= 0 or size > 8: - localError(c.config, it.info, "size may only be 1, 2, 4 or 8") - else: + case size + of 1, 2, 4, 8: sym.typ.size = size - # TODO, this is not correct - sym.typ.align = int16(size) + if size == 8 and c.config.target.targetCPU == cpuI386: + sym.typ.align = 4 + else: + sym.typ.align = int16(size) + else: + localError(c.config, it.info, "size may only be 1, 2, 4 or 8") of wNodecl: noVal(c, it) incl(sym.loc.flags, lfNoDecl) diff --git a/compiler/semmagic.nim b/compiler/semmagic.nim index 6e5563d69..77286393e 100644 --- a/compiler/semmagic.nim +++ b/compiler/semmagic.nim @@ -353,9 +353,17 @@ proc magicsAfterOverloadResolution(c: PContext, n: PNode, localError(c.config, n.info, "cannot evaluate 'sizeof' because its type is not defined completely, type: " & n[1].typ.typeToString) result = n of mAlignOf: - result = newIntNode(nkIntLit, getAlign(c.config, n[1].typ)) - result.info = n.info - result.typ = n.typ + # this is 100% analog to mSizeOf, could be made more dry. + let align = getAlign(c.config, n[1].typ) + if align == szUnknownSize: + result = n + elif align >= 0: + result = newIntNode(nkIntLit, align) + result.info = n.info + result.typ = n.typ + else: + localError(c.config, n.info, "cannot evaluate 'alignof' because its type is not defined completely, type: " & n[1].typ.typeToString) + result = n of mOffsetOf: var dotExpr: PNode diff --git a/compiler/semtempl.nim b/compiler/semtempl.nim index d920a54b8..f180b5373 100644 --- a/compiler/semtempl.nim +++ b/compiler/semtempl.nim @@ -558,6 +558,10 @@ proc semTemplateDef(c: PContext, n: PNode): PNode = incl(s.flags, sfGlobal) else: s = semIdentVis(c, skTemplate, n.sons[0], {}) + + if s.owner != nil and s.owner.name.s == "system" and s.name.s in ["!=", ">=", ">", "incl", "excl", "in", "notin", "isnot"]: + incl(s.flags, sfCallSideLineinfo) + styleCheckDef(c.config, s) onDef(n[0].info, s) # check parameter list: diff --git a/compiler/suggest.nim b/compiler/suggest.nim index 70a085bdf..d501acd46 100644 --- a/compiler/suggest.nim +++ b/compiler/suggest.nim @@ -495,7 +495,7 @@ proc suggestSym*(conf: ConfigRef; info: TLineInfo; s: PSym; usageSym: var PSym; proc extractPragma(s: PSym): PNode = if s.kind in routineKinds: result = s.ast[pragmasPos] - elif s.kind in {skType, skVar, skLet}: + elif s.kind in {skType, skVar, skLet} and s.ast[0].kind == nkPragmaExpr: # s.ast = nkTypedef / nkPragmaExpr / [nkSym, nkPragma] result = s.ast[0][1] doAssert result == nil or result.kind == nkPragma diff --git a/koch.nim b/koch.nim index 253352c22..5deda5ecd 100644 --- a/koch.nim +++ b/koch.nim @@ -299,9 +299,8 @@ proc boot(args: string) = var extraOption = "" if i == 0: extraOption.add " --skipUserCfg --skipParentCfg" - # Note(D20190115T162028:here): the configs are skipped for bootstrap + # The configs are skipped for bootstrap # (1st iteration) to prevent newer flags from breaking bootstrap phase. - # fixes #10030. let ret = execCmdEx(nimStart & " --version") doAssert ret.exitCode == 0 let version = ret.output.splitLines[0] diff --git a/lib/pure/math.nim b/lib/pure/math.nim index 526ddbbb2..f94da043a 100644 --- a/lib/pure/math.nim +++ b/lib/pure/math.nim @@ -1185,7 +1185,7 @@ when isMainModule: doAssert floorMod(-8.5, 3.0) ==~ 0.5 block: # log - doAssert log(4.0, 3.0) == ln(4.0) / ln(3.0) + doAssert log(4.0, 3.0) ==~ ln(4.0) / ln(3.0) doAssert log2(8.0'f64) == 3.0'f64 doAssert log2(4.0'f64) == 2.0'f64 doAssert log2(2.0'f64) == 1.0'f64 diff --git a/testament/specs.nim b/testament/specs.nim index bfc6b051e..96b02746b 100644 --- a/testament/specs.nim +++ b/testament/specs.nim @@ -206,6 +206,9 @@ proc parseSpec*(filename: string): TSpec = if isTravis: result.err = reDisabled of "appveyor": if isAppVeyor: result.err = reDisabled + of "32bit": + if sizeof(int) == 4: + result.err = reDisabled else: result.parseErrors.addLine "cannot interpret as a bool: ", e.value of "cmd": diff --git a/tests/concepts/texplain.nim b/tests/concepts/texplain.nim index ac0c972f5..4ec848732 100644 --- a/tests/concepts/texplain.nim +++ b/tests/concepts/texplain.nim @@ -65,14 +65,14 @@ expression: f(y) ''' errormsg: "type mismatch: got <MatchingType>" line: 138 -""" - - - - - + disabled: 32bit +""" +# disabled on 32 bit, because the order of suggested alternatives ``r`` differs +# proc r[T](a: SomeNumber; b: T; c: auto) +# proc r(i: string): int +# proc r(o: RegularConcept): int diff --git a/tests/converter/tgenericconverter2.nim b/tests/converter/tgenericconverter2.nim index 017651a6b..6d1d3d859 100644 --- a/tests/converter/tgenericconverter2.nim +++ b/tests/converter/tgenericconverter2.nim @@ -1,6 +1,8 @@ # bug #3799 -discard """ -output: ''' + +import strutils + +const output = splitLines(""" 00000000000000000000000000000000000000000 00000000000001111111111111110000000000000 00000000001111111111111111111110000000000 @@ -28,11 +30,7 @@ output: ''' 00000000111111111111111111111111100000000 00000000000111111111111111111100000000000 00000000000000111111111111100000000000000 -''' -""" - - -import macros +""") const nmax = 500 @@ -63,19 +61,25 @@ proc julia*[T](z0, c: Complex[T], er2: T, nmax: int): int = template dendriteFractal*[T](z0: Complex[T], er2: T, nmax: int): int = julia(z0, (T(0.0), T(1.0)), er2, nmax) -iterator stepIt[T](start, step: T, iterations: int): T = +iterator stepIt[T](start, step: T, iterations: int): (int, T) = for i in 0 .. iterations: - yield start + T(i) * step + yield (i, start + T(i) * step) +var errors = 0 let c = (0.36237, 0.32) -for y in stepIt(2.0, -0.0375 * 4, 107 div 4): +for j, y in stepIt(2.0, -0.0375 * 4, 107 div 4): var row = "" - for x in stepIt(-2.0, 0.025 * 4, 160 div 4): + for i, x in stepIt(-2.0, 0.025 * 4, 160 div 4): #let n = julia((x, y), c, 4.0, nmax) ### this works let n = dendriteFractal((x, y), 4.0, nmax) - if n < nmax: - row.add($(n mod 10)) - else: - row.add(' ') - echo row + let c = char(int('0') + n mod 10) + let e = output[j][i] # expected + if c != e: + errors += 1 + row.add(c) + + # Printing aparently makes the test fail when joined. + # echo row + +doAssert errors < 10, "total errors: " & $errors diff --git a/tests/enum/tenummix.nim b/tests/enum/tenummix.nim index c7db4e056..8c306bae1 100644 --- a/tests/enum/tenummix.nim +++ b/tests/enum/tenummix.nim @@ -1,7 +1,7 @@ discard """ - tfile: "tenummix.nim" - tline: 11 errormsg: "type mismatch" + file: "tenummix.nim" + line: 11 """ type diff --git a/tests/errmsgs/tunknown_named_parameter.nim b/tests/errmsgs/tunknown_named_parameter.nim index 8a3bcaf03..3051787ea 100644 --- a/tests/errmsgs/tunknown_named_parameter.nim +++ b/tests/errmsgs/tunknown_named_parameter.nim @@ -16,9 +16,12 @@ proc rsplit(s: string; sep: string; maxsplit: int = -1): seq[string] expression: rsplit("abc:def", {':'}, maxsplits = 1) ''' +disabled: 32bit """ # bug #8043 +# disabled on 32 bit systems because the order of suggested proc alternatives is different. + import strutils "abc:def".rsplit({':'}, maxsplits = 1) diff --git a/tests/generics/trtree.nim b/tests/generics/trtree.nim index 6ec1c8f6f..f14335154 100644 --- a/tests/generics/trtree.nim +++ b/tests/generics/trtree.nim @@ -3,8 +3,10 @@ discard """ [0, 0]''' target: "c" joinable: false +disabled: 32bit """ +# this test wasn't written for 32 bit # don't join because the code is too messy. # Nim RTree and R*Tree implementation diff --git a/tests/misc/tradix.nim b/tests/misc/tradix.nim index 5be89530f..1773a9609 100644 --- a/tests/misc/tradix.nim +++ b/tests/misc/tradix.nim @@ -246,6 +246,9 @@ proc main() = r: PRadixNode = nil for x in items(numbers): echo testOrIncl(r, x) - for x in elements(r): echo(x) + for x in elements(r): + # ByteAddress being defined as a signed integer cases trouble + # exactly here + echo(cast[uint](x)) main() diff --git a/tests/misc/tsizeof.nim b/tests/misc/tsizeof.nim index 25c566171..f2bed4743 100644 --- a/tests/misc/tsizeof.nim +++ b/tests/misc/tsizeof.nim @@ -279,6 +279,11 @@ testinstance: InheritanceC {.objectconfig.} = object of InheritanceB c: char + # from issue 4763 + GenericObject[T] = object + a: int32 + b: T + #Float128Test = object # a: byte # b: float128 @@ -298,6 +303,7 @@ testinstance: var f : PaddingAfterBranch var g : RecursiveStuff var ro : RootObj + var go : GenericObject[int64] var e1: Enum1 @@ -311,7 +317,7 @@ testinstance: testAlign(SimpleAlignment) - testSizeAlignOf(t,a,b,c,d,e,f,g,ro, e1, e2, e4, e8, eoa, eob) + testSizeAlignOf(t,a,b,c,d,e,f,g,ro,go, e1, e2, e4, e8, eoa, eob) when not defined(cpp): type @@ -414,6 +420,28 @@ type doAssert sizeof(MixedBitsize) == 12 +########################################## +# bug #9794 +########################################## + +type + imported_double {.importc: "double".} = object + + Pod = object + v* : imported_double + seed*: int32 + + Pod2 = tuple[v: imported_double, seed: int32] + +proc foobar() = + testAlign(Pod) + testSize(Pod) + testAlign(Pod2) + testSize(Pod2) + doAssert sizeof(Pod) == sizeof(Pod2) + doAssert alignof(Pod) == alignof(Pod2) +foobar() + if failed: quit("FAIL") else: diff --git a/tests/objects/tobject3.nim b/tests/objects/tobject3.nim index a24a48c8b..0a3df02ea 100644 --- a/tests/objects/tobject3.nim +++ b/tests/objects/tobject3.nim @@ -1,10 +1,7 @@ discard """ output: '''TBar2 TFoo -16 -12 -16 -12''' +''' """ ## XXX this output needs to be adapated for VCC which produces different results. @@ -67,29 +64,6 @@ var aa = makeWindow() thisCausesError(dd, aa) -# bug #4763 -type - testObject_1 = object - size: int32 - value: int64 - - testObject_2 {.packed.} = object - size: int32 - value: int64 - - testObject_3[T] = object - size: int32 - value: T - - testObject_4 {.packed.} [T] = object - size: int32 - value: T - -echo sizeof(testObject_1) -echo sizeof(testObject_2) -echo sizeof(testObject_3[int64]) -echo sizeof(testObject_4[int64]) - # bug #5892 type Foo6 = distinct array[4, float32] diff --git a/tests/stdlib/tosproc.nim b/tests/stdlib/tosproc.nim index b8d3be9bb..363de9096 100644 --- a/tests/stdlib/tosproc.nim +++ b/tests/stdlib/tosproc.nim @@ -48,10 +48,10 @@ when defined(case_testfile): # compiled test file for child process else: import os, osproc, strutils, posix + const nim = getCurrentCompilerExe() block execShellCmdTest: ## first, compile child program - const nim = getCurrentCompilerExe() const sourcePath = currentSourcePath() let output = buildDir / "D20190111T024543".addFileExt(ExeExt) let cmd = "$# c -o:$# -d:release -d:case_testfile $#" % [nim, output, @@ -71,14 +71,10 @@ else: runTest("exitnow_139", 139) runTest("c_exit2_139", 139) runTest("quit_139", 139) - runTest("exit_array", 1) - when defined(posix): # on windows, -1073741571 - runTest("exit_recursion", SIGSEGV.int + 128) # bug #10273: was returning 0 - assertEquals exitStatusLikeShell(SIGSEGV), SIGSEGV + 128.cint block execProcessTest: let dir = parentDir(currentSourcePath()) - let (outp, err) = execCmdEx("nim c " & quoteShell(dir / "osproctest.nim")) + let (outp, err) = execCmdEx(nim & " c " & quoteShell(dir / "osproctest.nim")) doAssert err == 0 let exePath = dir / addFileExt("osproctest", ExeExt) let outStr1 = execProcess(exePath, workingDir = dir, args = ["foo", diff --git a/tests/system/t7894.nim b/tests/system/t7894.nim index b7ca1eec8..36711501e 100644 --- a/tests/system/t7894.nim +++ b/tests/system/t7894.nim @@ -2,6 +2,7 @@ discard """ disabled: "travis" disabled: "appveyor" joinable: false +disabled: 32bit """ # CI integration servers are out of memory for this test diff --git a/tests/system/talloc2.nim b/tests/system/talloc2.nim index 7e0dec9d3..4958cda6d 100644 --- a/tests/system/talloc2.nim +++ b/tests/system/talloc2.nim @@ -5,40 +5,42 @@ joinable: false # appveyor is "out of memory" -const - nmax = 2*1024*1024*1024 +when sizeof(int) >= 8: + # no point to test this on system with smaller address space + const + nmax = 2*1024*1024*1024 -proc test(n: int) = - var a = alloc0(9999) - var t = cast[ptr UncheckedArray[int8]](alloc(n)) - var b = alloc0(9999) - t[0] = 1 - t[1] = 2 - t[n-2] = 3 - t[n-1] = 4 - dealloc(a) - dealloc(t) - dealloc(b) + proc test(n: int) = + var a = alloc0(9999) + var t = cast[ptr UncheckedArray[int8]](alloc(n)) + var b = alloc0(9999) + t[0] = 1 + t[1] = 2 + t[n-2] = 3 + t[n-1] = 4 + dealloc(a) + dealloc(t) + dealloc(b) -# allocator adds 48 bytes to BigChunk -# BigChunk allocator edges at 2^n * (1 - s) for s = [1..32]/64 -proc test2(n: int) = - let d = n div 256 # cover edges and more - for i in countdown(128,1): - for j in [-4096, -64, -49, -48, -47, -32, 0, 4096]: - let b = n + j - i*d - if b>0 and b<=nmax: - test(b) - #echo b, ": ", getTotalMem(), " ", getOccupiedMem(), " ", getFreeMem() + # allocator adds 48 bytes to BigChunk + # BigChunk allocator edges at 2^n * (1 - s) for s = [1..32]/64 + proc test2(n: int) = + let d = n div 256 # cover edges and more + for i in countdown(128,1): + for j in [-4096, -64, -49, -48, -47, -32, 0, 4096]: + let b = n + j - i*d + if b>0 and b<=nmax: + test(b) + #echo b, ": ", getTotalMem(), " ", getOccupiedMem(), " ", getFreeMem() -proc test3 = - var n = 1 - while n <= nmax: - test2(n) - n *= 2 - n = nmax - while n >= 1: - test2(n) - n = n div 2 + proc test3 = + var n = 1 + while n <= nmax: + test2(n) + n *= 2 + n = nmax + while n >= 1: + test2(n) + n = n div 2 -test3() + test3() diff --git a/tests/types/tfinalobj.nim b/tests/types/tfinalobj.nim index 6a1c8c2ce..94f2e4f0e 100644 --- a/tests/types/tfinalobj.nim +++ b/tests/types/tfinalobj.nim @@ -1,6 +1,5 @@ discard """ - output: '''abc -16 == 16''' + output: '''abc''' """ type @@ -14,20 +13,3 @@ a.x = "abc" doAssert TA.sizeof == string.sizeof echo a.x - -########################################## -# bug #9794 -########################################## -type - imported_double {.importc: "double".} = object - - Pod = object - v* : imported_double - seed*: int32 - - Pod2 = tuple[v: imported_double, seed: int32] - -proc test() = - echo sizeof(Pod), " == ",sizeof(Pod2) - -test() \ No newline at end of file diff --git a/tests/vm/tvmops.nim b/tests/vm/tvmops.nim index c9caaf32b..6442c49d6 100644 --- a/tests/vm/tvmops.nim +++ b/tests/vm/tvmops.nim @@ -40,6 +40,11 @@ static: let a2 = arcsin 0.3 doAssert a1 == a2 + block bitxor: + let x = -1'i32 + let y = 1'i32 + doAssert (x xor y) == -2 + block: # Check against bugs like #9176 doAssert getCurrentCompilerExe() == forceConst(getCurrentCompilerExe()) diff --git a/tests/vm/tzero_extend.nim b/tests/vm/tzero_extend.nim index a79105531..76aa9ee67 100644 --- a/tests/vm/tzero_extend.nim +++ b/tests/vm/tzero_extend.nim @@ -13,14 +13,14 @@ proc get_values(): (seq[int8], seq[int16], seq[int32]) = result[0] = @[]; result[1] = @[]; result[2] = @[] for offset in RANGE: - let i8 = -(1 shl 9) + offset - let i16 = -(1 shl 17) + offset - let i32 = -(1 shl 33) + offset + let i8 = -(1'i64 shl 9) + offset + let i16 = -(1'i64 shl 17) + offset + let i32 = -(1'i64 shl 33) + offset # higher bits are masked. these should be exactly equal to offset. - result[0].add i8.toU8 - result[1].add i16.toU16 - result[2].add i32.toU32 + result[0].add cast[int8 ](uint8 cast[uint64](i8 )) + result[1].add cast[int16](uint16 cast[uint64](i16)) + result[2].add cast[int32](uint32 cast[uint64](i32)) # these values this computed by VM |