let h = high(int) works
but
let h = high(uint) does not work
Suggestions?
high(uint) is not defined. PR pending #6620
div is only defined for integers while / is float only. This is because Nim is statically typed and dividing it to get floats should be a deliberate choice and not a due to programming reflex.
Note that there is a lenientops module for relaxed type checking when mixing integers and float operations: https://nim-lang.org/docs/lenientops.html
Thanks. I mentioned it (uint.high) mostly for general interest anyway because I almost always use specific intXX and uintXX types.
What I said does hold true, however, also for and specifically for uint64.
echo "max uint32: " & uint32.high (and smaller sizes) does compile/work
but
echo "max uint64: " & uint64.high does not compile.
Note that int64.high also compiles and works. It seems hence that the uint64 case is simply a forgotten one that can and should be easily fixed.
As for int/uint I'm bewildered by the argument (not an ordinal) because one would assume that Nim (like most languages) has those defined to be whatever the bit size of a system happens to be, i.e. int is either int32 or int64 and the same for uint.
Well you're not alone in wanting high(uint64). The easiest is
proc high(T: type uint64): uint64 =
not 0'u64
Make sure to check the works done at Status for crypto in Nim:
A couple of others have implemented HKDF and an alternative wrapper to BLS as well.
Thanks. I'll wait (and of course just like you have an interim work around).
Nice work btw. (NimCrypto).