Quote:

Looks very neat and simple to me.




Yes, however you've chosen a simple case which makes for simple code

You've also introduced a conditional and branch into something which should be pure bit-wise maths. This is an unnecessary overhead which will only get worse when the data becomes more complex.

Consider a general purpose function uset to reset bits:

Code:
"Simple (one bit case)   : " udfSwitchOffBits(89,16) ?
"Complex (many bit case) : " DecToHex(udfSwitchOffBits(&FFFFFF,&555555)) ?

Function udfSwitchOffBits($iValue,$iOffBits)
$udfSwitchOffBits=$iValue & (~$iOffBits)
EndFunction



I'll be very impressed if you can keep udfSwitchOffBits() anywhere near as simple using XOR. I can smell an impromptu Golf tournament on the wind