On Mon, 19 Jun 2006, Chris McCormick wrote:
Pd implementation of XOR attached. Why doesn't Pd include a bitwise NOT operator? Or did I miss something?
It doesn't because it's not specified nor clear nor obvious which format of integers we want to use with it.
Pd uses the float32 number type, in which the largest embeddable int type would be int25, but it can also make sense to think of it as int24 (because 24 is multiple of 8) or as uint24.
Another issue is the interpretation of the sign bit. With floats, flipping the sign bit just negates the number, but with ints, it's normally assumed that flipping it will shift the number by 1<<N... e.g. for N=8, the char type of C has weights:
-256 64 32 16 8 4 2 1
compared to unsigned char that has 128 instead of -256, and compared to float, in which the bits don't just add up like that, they behave like [...] 128 64 32 16 8 4 2 1 for sign 0, and -128 -64 -32 -16 -8 -4 -2 -1 for sign 1.
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju | Freelance Digital Arts Engineer, Montréal QC Canada