Julia Bitwise Operators
In this Julia Tutorial, we will learn about Julia Bitwise Operators.
The following table lists available bitwise operators in Julia.
Expression | Name |
---|---|
~x | bitwise not |
x & y | bitwise and |
x | y | bitwise or |
x ? y | bitwise xor (exclusive or) |
x >>> y | logical shift right |
x >> y | arithmetic shift right |
x << y | logical/arithmetic shift left |
Bitwise NOT
julia> x = 10
10
julia> ~x
-11
Bitwise AND
julia> x = 10
10
julia> y = 25
25
julia> x & y
8
Bitwise OR
julia> x = 10
10
julia> y = 25
25
julia> x | y
27
Bitwise XOR
julia> x = 10
10
julia> y = 25
25
julia> x ? y
19
Logical Shift Right
julia> x = 25
25
julia> x >>> 2
6
Arithmetic Shift Right
julia> x = 25
25
julia> x >> 2
6
Logical/Arithmetic Shift Left
julia> x = 25
25
julia> x << 1
50
Conclusion
In this Julia Tutorial, we learned Julia Bitwise Operators and how to use them with examples.