4 ;#define B0 (0x55555555)
7 ;#define B1 (0x33333333)
10 ;#define B2 (0x0F0F0F0F)
13 ;#define B3 (0x001F001F)
16 ;#define B4 (0x0000003F)
22 ;int countbits(int x) {
26 ;load address of B0 into r3
30 ;x = (x & B0) + ((x >> 1) & B0);
43 ;x = (x & B0) + ((x >> 1) & B0);
46 ;load B1 into r2, use displacment for address of B1 (or add?)
49 ;x = (x & B1) + ((x >> 2) & B1);
57 ;x = (x + (x >> 4)) & B2;
66 ;x = (x + (x >> 8)) /*& B3 */
71 ;x = (x + (x >> 16)) & B4;
80 int computeparity(int x)
85 return (0x6996 >> x) & 1;