Difference between revisions of "Byte"
TriciaNoonan (Talk | contribs) |
Gonzalo58T (Talk | contribs) (Expanded and made more exact) |
||
Line 1: | Line 1: | ||
− | A byte represents 8 bits of data. A bit of data is simply a 1 or 0 | + | A byte represents (most often) 8 (can be 10, 12, 15... depending on your architecture) bits of data. A bit of data is simply a 1 or 0, that may represent an "off" or "on" state, or whatever the programmer decides. |
− | + | == Representation == | |
+ | 8-bits bytes are typically described by two [http://wiki.dotslashproductions.net/Assembly_Basics#Counting hexadecimal] characters. | ||
− | + | Hexadecimal is often notated with character ranges from 0 to 9 and then from A F. A represents "10", B 11, C 12, D 13, E 14, F 15. | |
− | + | ||
− | + | == How to read an hexadecimal number, and a byte == | |
− | + | {{quote|Just like decimal numbers, you epsilons!|Savitri}} | |
+ | Let's take a random byte: 11010011 | ||
+ | |||
+ | In hexadecimal, it is: D3 | ||
+ | |||
+ | Hexadecimal, means (that's greek) "radix 16", or more commonly "base 16". | ||
+ | |||
+ | So this means, reading from right to left, the first ranking number will be multipled by 16^0 (equals 1), second ranking number will be multipled by 16<sup>1</sup> (equals 16), third by 16<sup>2</sup>, n<sup>th</sup> by 16<sup>n+1</sup>... | ||
+ | |||
+ | * 3 in hexadecimal is 3 in decimal, too (how surprising!) | ||
+ | * D in hexadecimal is 13 in decimal, too. | ||
+ | |||
+ | So to convert this number to base 10, we compute: | ||
+ | |||
+ | 3 * 1 + 13 * 16 = 3 + 208 = 211 | ||
+ | |||
+ | |||
+ | = Reference = | ||
+ | <pre> | ||
0 1 2 3 4 5 6 7 8 9 A B C D E F | 0 1 2 3 4 5 6 7 8 9 A B C D E F | ||
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ||
− | + | </pre> | |
[[Category:Information]] | [[Category:Information]] |
Revision as of 01:46, 16 November 2011
A byte represents (most often) 8 (can be 10, 12, 15... depending on your architecture) bits of data. A bit of data is simply a 1 or 0, that may represent an "off" or "on" state, or whatever the programmer decides.
Representation
8-bits bytes are typically described by two hexadecimal characters.
Hexadecimal is often notated with character ranges from 0 to 9 and then from A F. A represents "10", B 11, C 12, D 13, E 14, F 15.
How to read an hexadecimal number, and a byte
Savitri says |
---|
Just like decimal numbers, you epsilons! |
Let's take a random byte: 11010011
In hexadecimal, it is: D3
Hexadecimal, means (that's greek) "radix 16", or more commonly "base 16".
So this means, reading from right to left, the first ranking number will be multipled by 16^0 (equals 1), second ranking number will be multipled by 161 (equals 16), third by 162, nth by 16n+1...
- 3 in hexadecimal is 3 in decimal, too (how surprising!)
- D in hexadecimal is 13 in decimal, too.
So to convert this number to base 10, we compute:
3 * 1 + 13 * 16 = 3 + 208 = 211
Reference
0 1 2 3 4 5 6 7 8 9 A B C D E F 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15