Versions Compared

Key

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

...

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

Prototypes

Code Block
languagecpp
          CPU_DATA  CPU_CntLeadZeros (CPU_DATA  val);
           
          CPU_DATA  CPU_CntLeadZeros08 (CPU_INT08U  val);
          CPU_DATA  CPU_CntLeadZeros16 (CPU_INT16U  val);
          CPU_DATA  CPU_CntLeadZeros32 (CPU_INT32U  val);
          CPU_DATA  CPU_CntLeadZeros64 (CPU_INT64U  val);


Arguments

val

Data value to count leading zero bits.

...

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.

Each CPU_CntLeadZerosXX() is available and implemented in cpu_core.c based on CPU_CFG_DATA_SIZE_MAX configuration as #define'd in cpu.h :

...

Notes / Warnings

None.

Example Usage

Code Block
languagecpp
          CPU_DATA  val;
          CPU_DATA  nbr_lead_zeros;
           
          val            = 0x0643A718;
          nbr_lead_zeros = CPU_CntLeadZeros(val);
          nbr_lead_zeros = CPU_CntLeadZeros08((CPU_INT08U)val);
          nbr_lead_zeros = CPU_CntLeadZeros16((CPU_INT16U)val);
          nbr_lead_zeros = CPU_CntLeadZeros32((CPU_INT32U)val);
          nbr_lead_zeros = CPU_CntLeadZeros64((CPU_INT64U)val);