Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
2 votes
6 answers
610 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,623
2 votes
3 answers
690 views

What effects does memory space have on bitwise shifts?

It is true that the bitwise left shift operation (shl) doubles the value of the integer being shifted. However, when constrained to a finite space, such as 8 bits for example, left shift will begin to ...
the_endian's user avatar
  • 1,152
39 votes
1 answer
9k views

Why was the caret used for XOR instead of exponentiation?

Not that it's really a problem for anyone that has faced this syntactic issue before, but I see a wild amount of confusion stemming from the use of the caret (^) as the XOR operation in lieu of the ...
Qix - MONICA WAS MISTREATED's user avatar
0 votes
1 answer
150 views

Why Num&sizeMinusOne faster than num&(size-1)

I've been told that when I have a hash table of size m and m=2^k, I can use the & operator as num & (size-1) instead of num % size, to fit the hashCode to my table size. I've also been told ...
user2630165's user avatar
0 votes
3 answers
747 views

Using Power of 2 numbers to represent types

Let's say that we have some values, represented by power of 2: TYPE_1 = 1 TYPE_2 = 2 TYPE_3 = 4 TYPE_4 = 8 ... I need to store some of these types in one value. Example: To represent TYPE_1 with ...
Rodrigo's user avatar
  • 1,077