Bitwise AND, OR, and XOR Operations Display the masks to verify that they cover the correct parts of the address: Extract and display the network and host parts of the address: The preceding example uses these bit operations: Complement ( ~ ), left shift ( << ), and bitwise AND ( & ). The remaining discussion provides details on argument handling for each group of bit operations, more information about literal-value handling in bit operations, and potential incompatibilities between MySQL 8.0 and older MySQL versions. For  & ,  | , and  ^  bit operations, the result type depends on whether the arguments are evaluated as binary strings or numbers: Examples of numeric evaluation: •Binary-string evaluation occurs when the arguments have a binary string type, and at least one of them is not a hexadecimal literal, bit literal, or  NULL  literal. Numeric evaluation occurs otherwise, with argument conversion to unsigned 64-bit integers as necessary. •Binary-string evaluation produces a binary string of the same length as the arguments. If the arguments have unequal lengths, an  ER_INVALID_BITWISE_OPERANDS_SIZE  error occurs. Numeric evaluation produces an unsigned 64-bit integer. Bitwise AND, OR, and XOR Operations 2264 mysql>  SELECT 64 | 1, X’40’ | X’01’; +--------+---------------+ | 64 | 1 | X’40’ | X’01’ | +--------+---------------+ | 65 | 65 | +-----------------+ | network part | +-----------------+ | fe80::219:0:0:0 | +-----------------+ +------------------+ | host part | +------------------+ | ::d1ff:fe91:1a72 | +------------------+ mysql>  SET @net_part = @ip & @net_mask; mysql>  SET @host_part = @ip & @host_mask; mysql>  SELECT INET6_NTOA(@net_part) AS ’network part’; mysql>  SELECT INET6_NTOA(@host_part) AS ’host part’; mysql>  SET @net_mask = ~INET6_ATON(’::’) << (128 - @net_len); mysql>  SET @host_mask = ~INET6_ATON(’::’) >> @net_len; mysql>  SELECT INET6_NTOA(@net_mask) AS ’network mask’; mysql>  SELECT INET6_NTOA(@host_mask) AS ’host mask’; +----------------------------+ | network mask | +----------------------------+ | ffff:ffff:ffff:ffff:ffff:: | +----------------------------+ +------------------------+ | host mask | +------------------------+ | ::ffff:255.255.255.255 | +------------------------+