File: ntz.h

package info (click to toggle)
avr-libc 1%3A1.6.2.cvs20080610-2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 14,848 kB
  • ctags: 55,619
  • sloc: ansic: 92,267; asm: 6,692; sh: 4,131; makefile: 2,481; python: 976; pascal: 426; perl: 116
file content (24 lines) | stat: -rw-r--r-- 761 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#ifndef	_NTZ_H
#define	_NTZ_H

/* Number of Tail Zeros:  ntz(x)= (ffs(x) ? ffs(x)-1 : 16)
   It works with all: cpp, gcc and gas expressions.	*/
#define ntz(x)	\
	( (1 & (((x) & 1) == 0))        \
	+ (1 & (((x) & 3) == 0))        \
    	+ (1 & (((x) & 7) == 0))        \
        + (1 & (((x) & 017) == 0))      \
        + (1 & (((x) & 037) == 0))      \
	+ (1 & (((x) & 077) == 0))      \
	+ (1 & (((x) & 0177) == 0))     \
	+ (1 & (((x) & 0377) == 0))     \
	+ (1 & (((x) & 0777) == 0))     \
	+ (1 & (((x) & 01777) == 0))    \
	+ (1 & (((x) & 03777) == 0))    \
	+ (1 & (((x) & 07777) == 0))    \
	+ (1 & (((x) & 017777) == 0))   \
	+ (1 & (((x) & 037777) == 0))   \
	+ (1 & (((x) & 077777) == 0))   \
	+ (1 & (((x) & 0177777) == 0)) )

#endif	/* !_NTZ_H */