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