Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/bitops.h

    r137691a r7a0359b  
    2727 */
    2828
    29 /** @addtogroup generic 
     29/** @addtogroup generic
    3030 * @{
    3131 */
     
    3636#define KERN_BITOPS_H_
    3737
     38#include <trace.h>
    3839
    39 /** Return position of first non-zero bit from left (i.e. [log_2(arg)]).
     40#ifdef __32_BITS__
     41        #define fnzb(arg)  fnzb32(arg)
     42#endif
     43
     44#ifdef __64_BITS__
     45        #define fnzb(arg)  fnzb64(arg)
     46#endif
     47
     48/** Return position of first non-zero bit from left (32b variant).
    4049 *
    41  * If number is zero, it returns 0
     50 * @return 0 (if the number is zero) or [log_2(arg)].
     51 *
    4252 */
    43 static inline int fnzb32(uint32_t arg)
     53NO_TRACE static inline uint8_t fnzb32(uint32_t arg)
    4454{
    45         int n = 0;
    46 
     55        uint8_t n = 0;
     56       
    4757        if (arg >> 16) {
    4858                arg >>= 16;
     
    7181}
    7282
    73 static inline int fnzb64(uint64_t arg)
     83/** Return position of first non-zero bit from left (64b variant).
     84 *
     85 * @return 0 (if the number is zero) or [log_2(arg)].
     86 *
     87 */
     88NO_TRACE static inline uint8_t fnzb64(uint64_t arg)
    7489{
    75         int n = 0;
    76 
     90        uint8_t n = 0;
     91       
    7792        if (arg >> 32) {
    7893                arg >>= 32;
     
    8398}
    8499
    85 #define fnzb(x) fnzb32(x)
    86 
    87100#endif
    88101
Note: See TracChangeset for help on using the changeset viewer.