apoc.bitwise.op

Details

Syntax

apoc.bitwise.op(a, operator, b)

Description

Returns the result of the bitwise operation

Arguments

Name

Type

Description

a

INTEGER

The lefthand side value of the bitwise operation.

operator

STRING

The type of bitwise operation to perform.

b

INTEGER

The righthand side value of the bitwise operation.

Returns

INTEGER

Usage examples

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

12

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

61

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

49

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

-61

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

240

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

15

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

15