Bitwise Function
- bit_count(x, bits) → bigint
Calculate the number of bits set in x (regarded as an integer with a signed bit) in the complementary code representation of 2.
SELECT bit_count(9, 64); -- 2 SELECT bit_count(9, 8); -- 2 SELECT bit_count(-7, 64); -- 62 SELECT bit_count(-7, 8); -- 6
- bitwise_and(x, y) → bigint
Returns the bitwise AND result of x and y in binary complement.
select bitwise_and(8, 7); -- 0
- bitwise_not(x) → bigint
Returns the result of x bitwise NOT in binary complement.
select bitwise_not(8);-- -9
- bitwise_or(x, y) → bigint
Returns the bitwise OR result of x and y in binary complement.
select bitwise_or(8,7);-- 15
- bitwise_xor(x, y) → bigint
Returns the bitwise XOR result of x and y in binary complementary code format.
Refer to bitwise_and_agg() and bitwise_or_agg() in Aggregate Function.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.