Open yuxiaomao opened 3 weeks ago
This entire UInt business here looks pretty wonky, can't we just do a pos < 0 || pos >= length
check like normal humans?
I searched UInt in std and got for example
So I thought it's the "normal" usage. Can change to pos < 0 || pos >= length
too if you prefer.
UInt seems to save a comparison (using OJULt)
Doesn't this just work incidentally because something like -1
becomes a large number that then exceeds length
? I don't see how this is sound because with a sufficiently small number you could end up with something that's < length
after casting.
Negative Int has the most significant bit at 1, with INT_MIN it's 0x80000000 and is always bigger (unsigned operation) than a normal length ranged from 0 to INT_MAX (0x7FFFFFFF)
Ah right, because the length is Int, not UInt... Well, if this is how you want to handle this then I'm fine with it.
Closes https://github.com/HaxeFoundation/hashlink/issues/723
Seems to be some missing cast from https://github.com/HaxeFoundation/haxe/pull/8408