Bit wise Operations
Bitwise operations are operations which occur to the individual bits of a number. For example, 5 is written as 101 in base 2, that is, 5 = 1012. Similarly, 3 = 112. In this case, operations occur on the individual bits.
For example, bit-wise and 3 and 5 is the and of the corresponding bits 101 and 11:
>> bitand(3, 5)
ans =
1
>> bitor(3, 5)
ans =
7
Relevant functions are:
- bitand
- bitor
- bitxor
- bitcmp
- bitshift
- bitset
- bitget
- bitmax
No comments:
Post a Comment