The bitwise comparison commonly used the binary to build bit-mask entries same of what by boolean type used (AND, OR, XOR, NOT). In computer world, each bit is the sum of smaller bits based on the placement. It is very easy for the computer's algorithm to read and understand it as it only uses 1 or 0 value (same with the boolean type). Please see the table below for you to understand further.
In the above's table, the bit value is 00101100. Also, you will notice that above each bit octet has its corresponding decimal value. In every bit 1 value is equal to its corresponding decimal value. So based on the table above we have:
( 1 = 0, 2 = 0, 4 = 1, 8 = 1, 16 = 0, 32 = 1, 64 = 0, 128 = 0 )
We have 4, 8 and 32 decimal values equates by bit 1. By adding this value, it would equal the decimal value of the bits total. In our case, 4 + 8 + 32 is equals to 44.
So the decimal value of binary value 00101100 is 44.
Please visit Microsoft documentation for the bitwise and its operators for more information.
No comments:
Post a Comment
Place your comments and ideas