Questions tagged [bit]
The bit tag has no summary.
30 questions
2 votes
5 answers
2k views
The size of a byte in platform independent software
When writing platform independent software in C++, can I nowadays safely1 assume that a byte has a size of 8 bits? Or do I have to calculate it like this, for example: #include <climits> std::...
2 votes
6 answers
667 views
What is the viability of engineering an integral type with values ranging from -1 to 254? Do types like this even exist?
In software engineering, often developers will utilize three different states of a signed integer, as a trilean: This tends to be quite typical: -1 - Represents something akin to a null pointer, as in ...
1 vote
2 answers
2k views
In C++, Why do bitwise operators convert 8 or 16 bit integers to 32 bit?
Is there a logical reason why the integer is upgraded to 32+ bits? I was trying to make an 8bit mask, and found myself a bit disappointed that the upgrade will corrupt my equations. sizeof( quint8(0)...
0 votes
4 answers
2k views
Can int16_t be easier on the processor then int?
I know that the compiler and architecture of a processor also have a role to play in this. But this is more of a "can it" rather then a "does it" question. I have already tried to research this, but ...
1 vote
2 answers
139 views
Meaning of Using BitVectors to Model Integers to account for Overflow
I have just encountered this sentence: Depending on the context, we may prefer to model integers as bitvectors rather than mathematical integers, since the Int type does not model overflow. I am ...
2 votes
3 answers
443 views
Why are CPUs' datapaths multiple of 8?
Current and common processing units are 8, 16, 32, 64, 128, etc bit. Why are their datapath multiple of 8 ? Is this all linked to the fact that the industry has settled with a 8-bit byte ? The PDP-7 ...
3 votes
5 answers
869 views
Why isn't byte | bit the only built in data type?
All languages I have seen so far have multiple builtin data types (int, double, float, char, long...). But if we look closely, they are just arbitrary arrays of bits, the only difference between them ...
4 votes
4 answers
7k views
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 ...