Skip to content

LeadingZeros

Narta Xaymar Dirks edited this page Oct 28, 2026 · 6 revisions
BlitzLLVM

LeadingZeros 〔BlitzLLVM〕

LeadingZeros:Int32 value:Int32
Parameter Mode Type Default Description
value In Int32 required An integer.

Returns: How many of the highest bits are 0.

Description

〔BlitzLLVM〕 This command does not exist in the original Blitz products. BlitzLLVM adds it.

Counts the bits that are 0 before the first 1, from the highest bit down. A number of 0 has all of its bits counted. This is a BlitzLLVM extension. It looks at the bits of the number the way its type has them, so the same value counts differently as a Byte, an Int or a Long: a number written in the program is an Int (32 bits) unless it is larger, and Byte, UByte, Short, UShort, UInt, Long and ULong give the other widths. A real or a text is taken as an Int, like the bit operators do.

Differences

  • Not in the originals.

Examples

Print LeadingZeros(1)
Print LeadingZeros(UByte(1))
Print LeadingZeros(Long(1))
Print LeadingZeros(0)
31
7
63
32

Related Commands

Exp, Floor, Log, TrailingZeros 〔BlitzLLVM〕

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally