The ~ operator is a unary (prefix) bitwise COMPLEMENT operator. This should not be confused with the ! operator which is a logical NOT operator. The ~ operator expects an integer right hand operand. If the operand is a string, it will be automatically coerced to an integer before the COMPLEMENT operator is applied.syntax: ~ <right_expr><right_expr> is refered to as the right operand and may be a simple value or complex expression.
e.g. ~ 0x1234 yields 0xEDCB ~ 0x00E0 yields 0xFFFFFF1F ~ 0 yields -1 ( as hex 0xFFFFFFFF) ~ -1 yields 0