Skip to main content
Stack Overflow
  1. About
  2. For Teams
Filter by
Sorted by
Tagged with
10 votes
5 answers
617 views

From my reading of this answer, it is possible to perform addition of two pairs of 4-bit integers, stored in 8-bit integers, with just one addition and some bitwise operations. Also, the author of ...
fantasie's user avatar
  • 358
5 votes
4 answers
344 views

I have two arrays, a and b. Each contain 16 bytes and I would like to add each b[i] to their corresponding a[i]. The arrays do not overlap and also I know that the resulting sums always fit in a byte ...
-2 votes
1 answer
133 views

Suppose I have an object comprising many small integer types. For example: uint16_t values[8]; Or as part of a union: union Data { uint16_t values[8]; // Other members }; I would like to ...
1 vote
1 answer
134 views

This is not asking about structure padding/packing, which refers to any unnamed bytes inserted into structures for alignment purposes. I have this function: #include <stdint.h> uint8_t get_index(...
1 vote
1 answer
493 views

The asm function strlen receives the link to a string as a char - Array. To to so, the function may use SWAR on general purpose register, but without using xmm register or SSE instructions. The ...
0 votes
1 answer
675 views

Given a 64 Bit general purpose register (Not a xmm register) in x64 architecture, filled with one byte unsigned values. How can I check it for a zero value simultaneously without using SSE ...
-1 votes
4 answers
606 views

I was recently faced with a given problem: There are 8 elements in the vector, each is represented by int8_t. Implement an algorithm in x86_64 that will add two vectors (uint64_t type). Adding ...
14 votes
1 answer
923 views

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 some code to find the minimum and maximum among a[i] ...
1 vote
3 answers
381 views

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, 0xFEED};. I know I can use SIMD to compare all elements ...
user avatar
5 votes
4 answers
612 views

The Stockfish chess engine needs to store, for its evaluation, both an endgame score and a middlegame score. Instead of storing them separately, it packs them into one int. The middlegame score is ...
3 votes
1 answer
243 views

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 approach is to byteswap them and do an ordinary integer ...
0 votes
2 answers
328 views

I have the following code which right packs every 4 bits of a 64 bit int. This is the naive way of doing it, I am using a lookup table and a loop. I am wondering if there is a faster bit twiddling, ...
Vic C's user avatar
  • 11
7 votes
4 answers
906 views

I'm trying to use uint64_t as if it was 8 lanes of uint8_ts; my goal is to implement a lane-by-lane less-than. This operation, given x and y, should produce a result with 0xFF in a lane if the value ...
Koz Ross's user avatar
  • 3,190
1 vote
2 answers
517 views

I'm trying to write a SWAR compare-for-equality operation, working on uint64_t pretending to be 8 'lanes' of uint8_t. The closest I've managed to achieve, based on techniques in Hacker's Delight and ...
Koz Ross's user avatar
  • 3,190
2 votes
2 answers
677 views

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 countless(x,n) \ (((~0UL/255*(127+(n))-((x)&~0UL/255*...
Koz Ross's user avatar
  • 3,190

15 30 50 per page
1
2

AltStyle によって変換されたページ (->オリジナル) /