tyInt tyUint fit target int bit width (#20829)

This commit is contained in:
Bung 2022-12-01 20:34:00 +08:00 • committed by GitHub
commit 658b28dc57
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 306 additions and 267 deletions

View file

@ -2001,7 +2001,7 @@ when notJSnotNims:
proc equalMem(a, b: pointer, size: Natural): bool =
nimCmpMem(a, b, size) == 0
proc cmpMem(a, b: pointer, size: Natural): int =
nimCmpMem(a, b, size)
nimCmpMem(a, b, size).int
when not defined(js):
proc cmp(x, y: string): int =
@ -2300,11 +2300,13 @@ else:
type ExitCodeRange = int8
else: # win32 uses low 32 bits
type ExitCodeRange = cint
if errorcode < low(ExitCodeRange):
rawQuit(low(ExitCodeRange).cint)
elif errorcode > high(ExitCodeRange):
rawQuit(high(ExitCodeRange).cint)
when sizeof(errorcode) > sizeof(ExitCodeRange):
if errorcode < low(ExitCodeRange):
rawQuit(low(ExitCodeRange).cint)
elif errorcode > high(ExitCodeRange):
rawQuit(high(ExitCodeRange).cint)
else:
rawQuit(errorcode.cint)
else:
rawQuit(errorcode.cint)