BitOperations.LeadingZeroCount Method

Definition

Overloads

LeadingZeroCount(UInt32)

Counts the number of leading zero bits in an unsigned 32-bit integer mask.

LeadingZeroCount(UInt64)

Counts the number of leading zero bits in an unsigned 64-bit integer mask.

LeadingZeroCount(UIntPtr)

Counts the number of leading zero bits in a mask. Similar in behavior to the x86 instruction LZCNT.

LeadingZeroCount(UInt32)

Source:
BitOperations.cs
Source:
BitOperations.cs
Source:
BitOperations.cs

Important

This API is not CLS-compliant.

Counts the number of leading zero bits in an unsigned 32-bit integer mask.

[System.CLSCompliant(false)]
public static int LeadingZeroCount (uint value);

Parameters

value
UInt32

The mask.

Returns

The number of leading zero bits in a mask.

Attributes

Remarks

This method is similar in behavior to the x86 instruction LZCNT.

Applies to

.NET 9 and other versions
Product Versions
.NET Core 3.0, Core 3.1, 5, 6, 7, 8, 9

LeadingZeroCount(UInt64)

Source:
BitOperations.cs
Source:
BitOperations.cs
Source:
BitOperations.cs

Important

This API is not CLS-compliant.

Counts the number of leading zero bits in an unsigned 64-bit integer mask.

[System.CLSCompliant(false)]
public static int LeadingZeroCount (ulong value);

Parameters

value
UInt64

The mask.

Returns

The number of leading zero bits in a mask.

Attributes

Remarks

This method is similar in behavior to the x86 instruction LZCNT.

Applies to

.NET 9 and other versions
Product Versions
.NET Core 3.0, Core 3.1, 5, 6, 7, 8, 9

LeadingZeroCount(UIntPtr)

Source:
BitOperations.cs
Source:
BitOperations.cs
Source:
BitOperations.cs

Important

This API is not CLS-compliant.

Counts the number of leading zero bits in a mask. Similar in behavior to the x86 instruction LZCNT.

[System.CLSCompliant(false)]
public static int LeadingZeroCount (UIntPtr value);

Parameters

value
UIntPtr

The value.

Returns

The count of leading zeros bits in a mask.

Attributes

Applies to

.NET 9 and other versions
Product Versions
.NET 7, 8, 9