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

wpf - Line breaks and indenting for the XAML of a saved FlowDocument? -

gtk - Python Window Resize -

c# - read full xml file data over tcp -