January 2019
Intermediate to advanced
798 pages
20h 33m
English
The special band() function is somewhat similar to the simple last() function, but instead of just returning the last value, it applies a bitmask with a bitwise AND to the value and returns the result of this operation. If we wanted to check for the least significant bit, the one that lets us know whether the unit is powered on, we would use a bitmask of 1. Assuming some other bits have been set, we could receive a value of 170 from the monitored system. In binary, that would be 10101010. Bitwise AND would multiply each bit down as shown in the column :
|
Decimal value |
Binary value |
|
|
Value |
170 |
10101010 |
|
Bitwise AND (multiplied down) |
||
|
Mask |
1 |
00000001 |
|
Result |
0 |
00000000 |
Read now
Unlock full access