Questions tagged [byte]
27 questions
101
votes
7 answers
What is the history of why bytes are eight bits?
What were the historical forces at work, the tradeoffs to make, in deciding to use groups of eight bits as the fundamental unit?
There were machines, once upon a time, using other word sizes. But today, for non-eight-bitness, you must look to museum…

DarenW
- 4,433
- 3
- 22
- 43
42
votes
12 answers
Is there an alternative to bits?
Is there an alternative to bits as the smallest unit of data? Something that won't be only 0 or 1, but actually hold many possible states in between? Wouldn't it be more natural to store floats like that?

Dokkat
- 557
- 4
- 6
35
votes
11 answers
Why do we still use floats?
I understand why floats served a purpose in the past. And I think I can see why they're useful in some simulation examples today. But I think those example are more exceptional than common. So I don't understand why floats are more prevalent in…
anon
12
votes
6 answers
Is power-of-two bits per word "convenient"? If it is, why is that?
I find several sources claiming that power-of-two bits in a binary word (such as 8-bits per byte) is a "good thing" or "convenient". I find no source pointing out why.
From What is the history of why bytes are eight bits? we read in the approved…

Andreas
- 299
- 1
- 8
12
votes
4 answers
Is there any danger in writing raw bytes to a file?
I'm working through a problem in Programming Pearls -- specifically, the implementation of a program which sorts a file containing, at most, 10,000,000 integers (Column 1, Problem 3). Since the book doesn't specify how the data should be stored in…

Drake Sobania
- 301
- 2
- 9
12
votes
5 answers
How do you compress ASCII strings into fewer bytes?
I'm working with an embedded device with a unique protocol that sends messages to other devices and I'm making an application that parses the sent packets. Each packet carries 8 bytes. The protocol is defined as where first byte is header and…

TtT23
- 1,553
- 4
- 20
- 28
7
votes
1 answer
Benefits of Java ByteArrayInputStream vs byte array?
I have a scenario where my Java process will be receiving a stream of binary data:
public class DataHandler {
public void handleData(DATA data) {
// TODO: Do something with data
}
}
I am trying to figure out the proper typing for…

herpylderp
- 2,017
- 3
- 21
- 27
7
votes
5 answers
How many bits' address is required for a computer with n bytes of memory?
How many bits of address is required (for the program counter for example) in a byte-addressed computer with 512 Mbyte RAM?
What does the formula look like?
How is this connected with the fact that 32 bits can address no more than 4 GB RAM?

Niklas Rosencrantz
- 8,008
- 17
- 56
- 95
6
votes
3 answers
What is the procedure(if any) to select bytes to represent opcodes?
TL;DR
What procedure is followed when selecting bytes to represent opcodes? Are byte(s) for opcodes just randomly chosen, and them mapped to mnemonics?
I recently learned from this answer that bytecode usually consists of instructions which have…

Christian Dean
- 2,790
- 1
- 22
- 38
5
votes
5 answers
How can the same sequence of bytes might represent an integer, floating-point number, character string, or machine instruction?
I have just started to study about computer systems and I came across this line. How can the difference in the contexts in which we view data objects make this happen?
Bytes store numbers, now that number represents something, a symbol or a…

Pranjal Kumar
- 603
- 1
- 5
- 9
5
votes
3 answers
Is a 'least significant bit' used anywhere practically today?
I'm working on a library that supports file reading, and right now I've always assumed that all the bytes are written in most significant bit first format. Is the least significant bit first format ever practically used anywhere today on any…

Water
- 356
- 1
- 12
4
votes
3 answers
How exactly is bytecode "parsed"?
How is Bytecode "parsed"?
It is my understand that Bytecode is a binary, intermediate representation of the syntax of a given programming language. Certain programming languages convert their source text into Bytecode which is then written to a…

Christian Dean
- 2,790
- 1
- 22
- 38
4
votes
4 answers
Byte addressable vs bit addressable
Why are most computers byte addressable instead of bit addressable?
By B/b addressable I mean that processor can operate on level of single B/b.
Bit addressable advantages:
Booleans have size of one bit.
You can directly access single bits in…

Ford O.
- 223
- 2
- 7
4
votes
1 answer
What is the difference between size and length?
It seems that the terms size and length are used interchangeably to describe how many bits, bytes or octets some data occupies, i.e. a length field in a data header is said to indicate the size of the data. Did I see this correctly? If not, how do…

user3998276
- 187
- 1
- 2
- 7
4
votes
1 answer
Endianness at bit level
I am learning the union and struct and I wrote the code below. What I do not understand is why the output is different when I change from a little endian to a big endian machine.
My understanding is that endianness is important when you have more…

user2296949
- 51
- 3