Skip to content

Instantly share code, notes, and snippets.

View winocm's full-sized avatar
💭
Lonely.

Sarah Purohit winocm

💭
Lonely.
View GitHub Profile
@rygorous
rygorous / gist:1440600
Created December 6, 2011 23:36
PPC rlwinm/rlwimi equivalent C code
static inline U32 ppcmask(U32 mb, U32 me)
{
U32 maskmb = ~0u >> mb;
U32 maskme = ~0u << (31 - me);
return (mb <= me) ? maskmb & maskme : maskmb | maskme;
}
static inline U32 rotl32(U32 x, U32 amount)
{
return (x << amount) | (x >> ((32 - amount) & 31));