Page 1 of 1

data size

Posted: Thu Nov 21, 2013 2:07 am
by Peijen
why is byte (8 bit) the standard "data" unit? it is so annoying when you have to pack things with bit mask. we should have used 4bits that way there is a single hexadecimal character representation of data unit and a byte = 2*hd, short = 4*hd, etc.

Jon, I expect you to re-design all cpu and compilers to make it so!

Re: data size

Posted: Thu Nov 21, 2013 2:39 am
by VLSmooth
The size of a byte probably has to due with the ascii table to represent characters.

Aha!
http://en.wikipedia.org/wiki/Byte wrote:Historically, the byte was the number of bits used to encode a single character of text in a computer and for this reason it is the smallest addressable unit of memory in many computer architectures.
And the 1962 book referred to by the above on page 39-40
http://archive.computerhistory.org/resources/text/IBM/Stretch/pdfs/Buchholz_102636426.pdf wrote:4.3 Data Hierarchies
...
Byte denotes a group of bits used to encode a character, or the number of bits transmitted in parallel to and from input-output units. A term other than character is used here because a given character rnay be represented in different applications by more than one code, and different codes rnay use diff erent numbers of bits (i.e., different byte sizes). In input-output transmission the grouping of bits rnay be completely arbitrary and have no relation to actual characters. (The term is coined from bite, but respelled to avoid accidental mutation to bit.)

Re: data size

Posted: Thu Nov 21, 2013 8:48 am
by Peijen
yeah, I already found those information, but it is not helpful! I am more asking about making data size 4 bits than why it is 8 bits. Maybe there is a library out there that would do that.

Re: data size

Posted: Fri Nov 22, 2013 6:46 am
by Jonathan
The term you are looking for is "nibble".

Also, frankly, 0-15 is a way more limited utility than 0-255. A lot of loops and whatnot fit into a byte. Substantially less fits into a nibble.