Closed C-NERD closed 1 year ago
apparently the problem is at
const
#HighestInt128 = newInteger("170141183460469231731687303715884105727", 10)
HighestUInt128 = newInteger("340282366920938463463374607431768211455", 10)
the library cannot initialize the wrapped function on compiled time
Sorry for slow response, but yes, external FFI doesn't seem to work out of the box at compile-time. I tried playing around with --experimental:compiletimeFFI
but I still can't get Nim to accept it.
It is fixed by changing the variable declaration from const
(compile-time) to let
(run-time const).
One additional note: the int
template is converting to strings to convert back to integers: there's already a n.getOr(default_value_if_it_doesnt_fit)
which will return an integer of equal type to the argument. Alternatively there's n.getUnsafe(int)
.
when i tried to compile a sample code
I get the error