[PD-dev] xor binop

pix pix at test.at
Thu Jan 23 02:58:32 CET 2003


i thought someone would have done this before, but here is a patch to
include an xor binop [^ ] to pd.

this came up because i really wanted a bitwise not... then i realised that
when you are dealing with floats, logical not doesn't make any sense (it's
not clear how many bits wide the result should be). but then i realised i
could fake a restricted kind of not, by xor-ing against an all-ones mask
which is as wide as i need.

so: "x ^ 255" is like NOT x when 0 <= x <= 255 (which you could always
ensure with an x & 255)

other, more normal uses of xor, i will leave up to your imagination.

included also is a version of the otherbinops.pd help file with the new
operator added.

by the way, i'm adding this as a patch to pd because it's too trivial to
make a new external for, and it should be in pd anyhow.

pix.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: x_arithmetic.c.patch
Type: application/octet-stream
Size: 1386 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-dev/attachments/20030123/b083bdab/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: otherbinops.pd
Type: application/octet-stream
Size: 2414 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-dev/attachments/20030123/b083bdab/attachment-0001.obj>


More information about the Pd-dev mailing list