How to enumerate the position of a bit within a byte?

Where to start putting an ordinal numbering on a given byte, do I start counting the most significant(the left )or the least significant (the right)?

For example for the decimal number 128 that has binary reprint:

1000 0000

If I want to refer to the eighth bit of the byte, who is the digit in question?
1 or 0 ?

Would

Be Mode A or mode B?
Mode A
1000 0000
8765 4321

Mode B
1000 0000
1234 5678

Author: Pena Pintada, 2017-06-12

1 answers

The mode to would be the correct one.

Ignore the name bit - a binary value is represented in the same way as a decimal value: in an integer the highest value positions are located on the left, since new positions are added When the previous position suffers overflow :

    8 + 1  // 9:     Uma casa decimal
    9 + 1  // 10:    Não pode ser contido em apenas uma posição,
   10      //        casa decimal 2 recebe o valor em overflow.
  ...
   98 + 1  // 99:    Duas casas decimais
   99 + 1  // 100:   Não pode ser contido em apenas duas posições, 
  100      //        casa decimal 3 recebe o valor em overflow.

Like this:

128 = 100 + 20 + 8

In the example above we can say that the position (house) 3 has the value 1, which means 100 in decimal.

In binary the value

1000 0000

Has the value 1 at position 8, which also means 128 (2 to 7A power).

 1
Author: OnoSendai, 2017-06-12 15:34:25