Skip to main content

All Questions

Tagged with
2 votes
6 answers
611 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 ...
Anon's user avatar
  • 3,633
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)...
Anon's user avatar
  • 3,633
1 vote
2 answers
570 views

C++ - BitVector logic

I have implemented a simple bit vector class. However, I have some problems with understanding, how to push data to it. In a standard vector, push_back inserts new element et the end. A similar ...
Martin Perry's user avatar
1 vote
3 answers
954 views

How can I query, increment & decrement arbitrary-length integers encoded into a bit-array?

I'm in the process of implementing a counting Bloom filter. This data structure is defined as a bit-array and a "width" parameter, W. The bit array stores unsigned integers, whose size is determined ...
Louis Thibault's user avatar
1 vote
3 answers
2k views

Bits - Least-Significant/Lowest is 0th or 1st; zero or one indexed

Question Is there a rough consensus if the bitmask 0x01 is properly said to have the "zeroth" bit set, or the "first" bit set? If there isn't rough consensus that there's a generally right answer, ...
mtraceur's user avatar
  • 259
19 votes
4 answers
96k views

How are negative signed values stored?

I was watching this video on the maximum and minimum values of signed integers. Take an example of a positive signed value - 0000 0001 The first bit denotes that the number is positive and the last ...
discussedtree's user avatar
5 votes
1 answer
7k views

Clearing the lowest set bit of a number

I can see in this tutorial on bit manipulation, under the heading "Extracting every last bit", that - Suppose we wish to find the lowest set bit of x (which is known to be non-zero). If we ...
theharshest's user avatar