Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Description

Counts the number of contiguous, most-significant, leading zero bits in a data value. If available on the targeted architecture an alternate optimized implementation can be defined.

Files

cpu_core.h/cpu_core.c / Specific CPU/compiler cpu_a.asm

Prototypes

Arguments

val

Data value to count leading zero bits.

Returned Value

Number of contiguous, most-significant, leading zero bits in val.

Required Configuration

CPU_CntLeadZeros()is available and implemented in cpu_core.c if CPU_CFG_LEAD_ZEROS_ASM_PRESENT is not #define'd in cpu_cfg.h (or cpu.h), but should be implemented in cpu_a.asm (or cpu_a.s) if CPU_CFG_LEAD_ZEROS_ASM_PRESENT is #define'd in cpu_cfg.h (or cpu.h). Refer to Core Library Configuration for details.

...

CPU_CntLeadZero08() = CPU_WORD_SIZE_08
CPU_CntLeadZero16() = CPU_WORD_SIZE_16
CPU_CntLeadZero32() = CPU_WORD_SIZE_32
CPU_CntLeadZero64() = CPU_WORD_SIZE_64

Notes / Warnings

None.

Example Usage