3

Possible Duplicate:
C# - count leading zeroes in an Int32

I'm looking for the C# equivalent to this: http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Long.html#numberOfLeadingZeros(long)

From the Java docs:

Returns the number of zero bits preceding the highest-order ("leftmost") one-bit in the two's complement binary representation of the specified long value.

Hopefully it is already implemented somewhere...

Community
  • 1
  • 1
synhershko
  • 4,472
  • 1
  • 30
  • 37
  • @coder, no that's a trailing zeros – synhershko May 03 '12 at 21:06
  • 4
    Looks like better cross class coordination in solving homework is needed - same question in 5 minutes from 2 different people is suspicious :) - http://stackoverflow.com/questions/10439242/c-sharp-count-leading-zeroes-in-an-int32. – Alexei Levenkov May 03 '12 at 21:08
  • @AlexeiLevenkov no not homework, but I admit that is strange... meanwhile found this implemented in Java Lucene's BitUtils - not sure why the implemented it when they had this available in the framework... – synhershko May 03 '12 at 21:23

0 Answers0