Hi
"Not" is a negation operator, so ofc, it will try to give you the negative value, but you can't have negatives in an unsigned type like cardinal, longword, dword, qword, ptruint or for that matter byte! If the compiler was an a***, it would give anything in between 0..high(datatype) that is NOT "2" in your example, so give it credit for trying to play along with your shenanigans...
Regards Benny