Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
_CountLeadingOnes, _CountLeadingOnes64

_CountLeadingOnes, _CountLeadingOnes64 

Visual Studio 2005

This function returns the number of contiguous one bits starting with the most significant bit.

unsigned __cdecl _CountLeadingOnes(
  long arg1

unsigned __cdecl _CountLeadingOnes64(
  __int64 arg1



[in] The long integer argument that the function examines to find one bits.

The number of contiguous one bits in arg1. If all bits in arg1 are set, the return value of _CountLeadingOnes is 32, or the value of _CountLeadingOnes64 is 64..

This function can be implemented by calling a runtime function.

Routine Required header Architecture



x86, ARM, SH-4, MIPS



x86, ARM, SH-4, MIPS

Community Additions

© 2015 Microsoft