bit manipulation - Fastest way to read Left-Most bit from unsigned int (C++)? -


What is the fastest way to read most bits from unsigned int?

Thanks, Online SW

  i & gt; & Gt; (Size (unsigned integer) * CHAR_BIT - 1)  

sizeof , multiplication and subtraction will be computed by any appropriate compiler at compile time, so it is a single The right-shift instruction should be made, the faster you can get it.


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -