Suppose I have two uint16_t[4] arrays, a and b. Each integer in these arrays is in the range [0, 16383], so bits 14 and 15 aren't set. Then I have som ...
Suppose I have two uint16_t[4] arrays, a and b. Each integer in these arrays is in the range [0, 16383], so bits 14 and 15 aren't set. Then I have som ...
I may confirm by using nanobench. Today I don't feel clever and can't think of an easy way I have a array, short arr[]={0x1234, 0x5432, 0x9090, 0xFEE ...
I need to do a lexicographic comparison of a small number of small unsigned integers. If there are (for example) 8 8-bit integers, the obvious approac ...
Bit Twiddling Hacks contains the following macros, which count the number of bytes in a word x that are less than, or greater than, n: #define countl ...
In the case of a 64-bit x86 register, is it possible to hold more than one value at a time in the same register, if the size of an value is small enou ...
If I have a 64-bit integer that I'm interpreting as an array of packed 8-bit integers with 8 elements. I need to subtract the constant 1 from each pac ...
I have two 64-bit integers x and y. Each of them represents 5 short unsigned integers: the first 10 bits represent the first integer, the next 13 bits ...
This question gives explanation about SWAR algorithm used for counting number of 1s in a given number. While explaining ilmari wrote 0x01010101 = (1 & ...
I'm currently working in C/C++, and I have a uint64_t. I need to do a bitwise rotation on the top 32 bits and the bottom 32 bits separately. So for ex ...
I have seen this code that counts the number of bits equals to 1 in 32-bit integer, and I noticed that its performance is better than __builtin_popc ...
I saw this Java code that does a perfect 50% blend between two RGB888 colors extremely efficiently: public static int blendRGB(int a, int b) { re ...
I checked out the SWAR algorithm (SIMD Within A Register) for reversing bit order of unsigned ints. Is there something similar for signed int? ...