CSharp examples for System:String Endian
Return word where a all bits from (including) the highest set bit to bit 0 are set.
using System;/*from w w w .ja va 2 s . co m*/ public class Main{ // Return word where a all bits from (including) the // highest set bit to bit 0 are set. // Return 0 if no bit is set. // // Feed the result into bit_count() to get // the index of the highest bit set. public static UInt32 HighestBit01Edge( UInt32 x ) { x |= x>>1; x |= x>>2; x |= x>>4; x |= x>>8; x |= x>>16; return x; } }