?? parity.h
字號(hào):
#ifndef _PARITY_H_
#define _PARITY_H_
#ifdef __i386__
static inline int parityb(unsigned char x){
__asm__ __volatile__ ("test $0xff,%1;setpo %0" : "=r"(x) : "g" (x));
return x;
}
#else
static inline int parityb(unsigned char x){
extern unsigned char Partab[256];
extern int P_init;
if(!P_init){
partab_init();
}
return Partab[x];
}
#endif
static inline int parity(int x){
/* Fold down to one byte */
x ^= (x >> 16);
x ^= (x >> 8);
return parityb(x);
}
#endif /* _PARITY_H_ */