Created
May 8, 2025 01:16
-
-
Save rygorous/94fd3c33afe4e650ec5bda386cbc16bb to your computer and use it in GitHub Desktop.
This file contains hidden or 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
uint EvenBitMask = 0x55555555u; | |
uint HighIndexBit = PackedIndices >> 1; | |
float NumWeight1 = float(countbits(EvenBitMask & ~HighIndexBit & PackedIndices)); | |
float NumWeight2 = float(countbits(EvenBitMask & HighIndexBit & ~PackedIndices)); | |
float NumWeight3 = float(countbits(EvenBitMask & HighIndexBit & PackedIndices)); | |
// with NV LOP3: 1 shift, 3 LOP3, 3 pop count, 3 int->float = 10 insns total for 16 pixels | |
// without: 1 shift, 2 NOT, 5 AND, 3 pop count, 3 int->float = 14 insns total for 16 pixels |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment