Page 1 of 1

Could you tell me what mean .Reg & ~0x10 in calculation

Posted: Thu Nov 16, 2023 10:52 am
by lucibel
hi
could you tell me what mean (.Reg & ~0x10) in calculation ?
especialy the "~"
thx

Re: Could you tell me what mean .Reg & ~0x10 in calculation

Posted: Thu Nov 16, 2023 11:21 am
by mnfisher
. Reg is a local variable.
~ is a bit wise 'not' (0 bits go to 1 and 1 to 0)
So this is often used for clearing a bit or bits in a variable or register - & (And) returns a result where there is a 1bit only if it is 1 in both arguments.

Martin