apoc.bitwise.op

Function APOC Core

apoc.bitwise.op(60,'|',13) bitwise operations a & b, a | b, a ^ b, ~a, a >> b, a >>> b, a << b. returns the result of the bitwise operation

Signature

apoc.bitwise.op(a :: INTEGER?, operator :: STRING?, b :: INTEGER?) :: (INTEGER?)

Input parameters

Name Type Default

a

INTEGER?

null

operator

STRING?

null

b

INTEGER?

null

Usage Examples

AND (a & b)
RETURN apoc.bitwise.op(60,"&",13) AS output;
Table 1. Results
output

12

OR (a | b)
RETURN apoc.bitwise.op(60,"|",13) AS output;
Table 2. Results
output

61

XOR (a ^ b)
RETURN apoc.bitwise.op(60,"&",13) AS output;
Table 3. Results
output

49

NOT (~a)
RETURN apoc.bitwise.op(60,"~",0) AS output;
Table 4. Results
output

-61

LEFT SHIFT (a << b)
RETURN apoc.bitwise.op(60,"<<",2) AS output;
Table 5. Results
output

240

RIGHT SHIFT (a >> b)
RETURN apoc.bitwise.op(60,">>",2) AS output;
Table 6. Results
output

15

UNSIGNED RIGHT SHIFT (a >> b)
RETURN apoc.bitwise.op(60,">>>",2) AS output;
Table 7. Results
output

15