swar Questions

1

Solved

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[...
Roomy asked 18/1, 2023 at 0:42

4

Solved

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 ...
Subaudition asked 22/11, 2022 at 2:27

4

Solved

int SWAR(unsigned int i) { i = i - ((i >> 1) & 0x55555555); i = (i & 0x33333333) + ((i >> 2) & 0x33333333); return (((i + (i >> 4)) & 0x0F0F0F0F) * 0x01010101) ...
Mitten asked 27/2, 2014 at 22:16

4

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 valu...
Laundryman asked 8/8, 2021 at 2:55

8

Solved

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 packed integer while handling overflow without the...
Careaga asked 7/1, 2020 at 23:56

2

Solved

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 represent the 2nd integer, the next 16 bits re...
Sheepskin asked 3/6, 2018 at 4:29

1

Solved

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) { return (a + b - ((a ^ b) & 0x00010101)) >&g...
1

© 2022 - 2024 — McMap. All rights reserved.