Hello, I would like to write a "popcnt" function. This works fine

ulong popcnt(ulong x)
{
asm { mov RAX, x ; popcnt RAX, RAX ; }
}

However, if I add the "naked" keyword ( which should improve performance? ) it doesn't work anymore and I can't figure out what change I am supposed to make ( aside from x[RBP] instead of x )
This function is going to be *heavily* used.

Thanks for any help.

Reply via email to