bitwise not external?

jasch's icon

hi, noob question here.

is there a bitwise NOT external for ints?

(i know about bitnot~ for floats, but what about normal ints? and i know how to patch an abstraction, thank you very much)

thanks

/*j

andrea agostini's icon

you can obtain it with [expr $i1 ^ -1]
aa

Roman Thilenius's icon

jasch==noob :)

jasch's icon

thanks andrea,
that looks good. not the bitnot external i was hoping for, but close enough.
altough expr also supports the "proper" bitnot operator ~

this solution gives a 32bit result, since max ints are 32 bits in size.
for my application i have to mask out the extra 16 bits since i'm actually working with shorts (16bits).

my patch looks like this: value - [expr ~ $i1] - [& 65535] - bitnot-value

Max Patch
Copy patch and select New From Clipboard in Max.

and here's my abstraction:

cheers

/*j