Created
May 28, 2022 02:13
-
-
Save UplinkCoder/6edb1eb50baff84783629fe0f4e81633 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uint8_t getMask(const int16_t hash, const int16x8_t LRU) | |
{ | |
// assert(hash & 0xF == 0); | |
const int16x8_t hash8 = {hash, hash, hash, hash, | |
hash, hash, hash, hash}; | |
const int16x8_t LRUHashes = LRU & ~0xF; | |
const int16x8_t matches = LRUHashes == hash8; | |
// == sets the result element to 0xFF on match | |
const int16x8_t multi = {1 << 0, 1 << 1, 1 << 2, 1 << 3, | |
1 << 4, 1 << 5, 1 << 6, 1 << 7}; | |
// horizontal add over all elements to get the result | |
return vaddvq_s16(matches & multi); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment