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:
PMunch 2019-11-28 17:11:56 +01:00 • committed by Andreas Rumpf
commit b662842bd0
2 changed files with 9 additions and 7 deletions

View file

@ -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]()