Skip to content

Instantly share code, notes, and snippets.

@rygorous
Created December 6, 2013 02:10
Embed
What would you like to do?
Why is your "High-Level Shading Language" lower-level in some places than the "assembly" you compile to?
int bitfieldInsert(int base, int insert, int offset, int bits)
{
int mask = (-1 >> (32 - bits)) << offset;
return (base & ~mask) | ((insert << offset) & mask);
}
---> (in usage)
bfi r7.yz, l(0, 16, 16, 0), l(0, 16, 16, 0), r8.yywy, r8.xxzx
sigh.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment