Fix compilation for 16 bit targets (#5286)

This commit is contained in:
Jeff Ciesielski 2017-01-26 01:05:03 -05:00 • committed by Andreas Rumpf
commit 7f30d04d6a
5 changed files with 6 additions and 6 deletions

View file

@ -67,7 +67,7 @@ type
rawTypePtr: pointer rawTypePtr: pointer
ppointer = ptr pointer ppointer = ptr pointer
pbyteArray = ptr array[0.. 0xffff, int8] pbyteArray = ptr array[0xffff, int8]
TGenericSeq {.importc.} = object TGenericSeq {.importc.} = object
len, space: int len, space: int

View file

@ -211,14 +211,14 @@ proc genericReset(dest: pointer, mt: PNimType) =
zeroMem(dest, mt.size) # set raw bits to zero zeroMem(dest, mt.size) # set raw bits to zero
proc selectBranch(discVal, L: int, proc selectBranch(discVal, L: int,
a: ptr array[0..0x7fff, ptr TNimNode]): ptr TNimNode = a: ptr array[0x7fff, ptr TNimNode]): ptr TNimNode =
result = a[L] # a[L] contains the ``else`` part (but may be nil) result = a[L] # a[L] contains the ``else`` part (but may be nil)
if discVal <% L: if discVal <% L:
var x = a[discVal] var x = a[discVal]
if x != nil: result = x if x != nil: result = x
proc FieldDiscriminantCheck(oldDiscVal, newDiscVal: int, proc FieldDiscriminantCheck(oldDiscVal, newDiscVal: int,
a: ptr array[0..0x7fff, ptr TNimNode], a: ptr array[0x7fff, ptr TNimNode],
L: int) {.compilerProc.} = L: int) {.compilerProc.} =
var oldBranch = selectBranch(oldDiscVal, L, a) var oldBranch = selectBranch(oldDiscVal, L, a)
var newBranch = selectBranch(newDiscVal, L, a) var newBranch = selectBranch(newDiscVal, L, a)

View file

@ -10,7 +10,7 @@
type type
PtrTable = ptr object PtrTable = ptr object
counter, max: int counter, max: int
data: array[0..0xff_ffff, (pointer, pointer)] data: array[0xff_ffff, (pointer, pointer)]
template hashPtr(key: pointer): int = cast[int](key) shr 8 template hashPtr(key: pointer): int = cast[int](key) shr 8
template allocPtrTable: untyped = template allocPtrTable: untyped =

View file

@ -70,7 +70,7 @@ type
typ: ptr TNimType typ: ptr TNimType
name: cstring name: cstring
len: int len: int
sons: ptr array[0..0x7fff, ptr TNimNode] sons: ptr array[0x7fff, ptr TNimNode]
TNimTypeFlag = enum TNimTypeFlag = enum
ntfNoRefs = 0, # type contains no tyRef, tySequence, tyString ntfNoRefs = 0, # type contains no tyRef, tySequence, tyString

View file

@ -89,7 +89,7 @@ proc reprEnum(e: int, typ: PNimType): string {.compilerRtl.} =
result = $e & " (invalid data!)" result = $e & " (invalid data!)"
type type
PByteArray = ptr array[0.. 0xffff, int8] PByteArray = ptr array[0xffff, int8]
proc addSetElem(result: var string, elem: int, typ: PNimType) {.benign.} = proc addSetElem(result: var string, elem: int, typ: PNimType) {.benign.} =
case typ.kind case typ.kind