_CountLeadingOnes, _CountLeadingOnes64

9/7/2007

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

Syntax

unsigned __cdecl _CountLeadingOnes(
  long arg1
);

unsigned __cdecl _CountLeadingOnes64(
  __int64 arg1
);

Parameters

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

Return Values

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.

Remarks

This function can be implemented by calling a runtime function.

Requirements

Routine Required header Architecture

_CountLeadingOnes

<cmnintrin.h>

ARM, SH-4, MIPS

_CountLeadingOnes64

<cmnintrin.h>

ARM, SH-4, MIPS

See Also

Other Resources

Intrinsic Functions for Device Compilers