How much space is there in a normal set of 8 bits?
I've been looking working with various开发者_StackOverflow number systems recently, and I've become somewhat confused about the "space" in a standard set of 8 bits.
I thought that 255 was the biggest possible number in a byte as it is a fully 'on' set of eight bits (0b11111111 or 0xFF), however I've see a number of people quoting the biggest possible number as 256, which just seems illogical to me. I've seen people write that RGB colour components go up to 256 for example.
Am I missing something here?
The largest possible number in an 8-bit byte is 255, however there are 256 values possible in a byte, because 0 is one possible value. In a 256-color map, there are 256 colors, numbered 0 through 255.
EDIT: There are 256 values in a byte:
0 is the 1st possible value
1 is the 2nd possible value
2 is the 3rd possible value
....
255 is the 256th possible value
精彩评论