Fix for 16 bit platforms (#12760) [backend]
This fixes some tiny issues with using Nim on 16-bit platforms. Not entirely sure why the AVR chip I was compiling for with "cpu = avr" was detected as 16-bit, but that's probably another issue..
This commit is contained in:
parent
010067f3cc
commit
b662842bd0
2 changed files with 9 additions and 7 deletions
|
|
@ -87,7 +87,9 @@ proc fac*(n: int): int =
|
|||
doAssert fac(4) == 24
|
||||
doAssert fac(10) == 3628800
|
||||
const factTable =
|
||||
when sizeof(int) == 4:
|
||||
when sizeof(int) == 2:
|
||||
createFactTable[5]()
|
||||
elif sizeof(int) == 4:
|
||||
createFactTable[13]()
|
||||
else:
|
||||
createFactTable[21]()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue