Closed sogaiu closed 1 year ago
I've implemented this on my local fork, I don't believe there's any issue:
(for n -99 100
(assert (compare= (bnot n) (bnot (int/s64 n)))))
(assert (= (int/u64 "0xFFFF_FFFF_FFFF_FFFF") (bnot (int/u64 0))))
Just an error of omission
Currently,
int/s64
andint/u64
support most of the common bit manipulation operations:https://github.com/janet-lang/janet/blob/b125cbeac9e43ca7adb3f066fef679ac58a91c71/src/core/inttypes.c#L549-L597
Notably absent is
complement
/not
.Is there a technical reason this could / should not be implemented?
primo-ppcg shared some considerations regarding some implementation considerations.