Name some bitwise operations you know
Name some bitwise operations you know
Bitwise operations are fundamental operations that directly manipulate individual bits of binary numbers. Here are some common bitwise operations:
&
)12 \& 25 \rightarrow 00001100 \& 00011001 = 00001000 \text{ (8 in decimal)}
|
)12 | 25 \rightarrow 00001100 | 00011001 = 00011101 \text{ (29 in decimal)}
^
)12 \oplus 25 \rightarrow 00001100 \oplus 00011001 = 00010101 \text{ (21 in decimal)}
~
)\sim 12 \rightarrow \sim 00001100 = 11110011 \text{ (-13 in decimal, considering two's complement representation)}
<<
)12 << 2 \rightarrow 00001100 << 2 = 00110000 \text{ (48 in decimal)}
>>
)junior
Chưa có bình luận nào