;int countbits(int x) {
countbits:
;x == r1
-
+
;load address of B0 into r3
ldil r3, B0@lo;
ldih r3, B0@hi;
;x = (x & B0) + ((x >> 1) & B0);
;r0 = (x >> 1)
lrs r0,r1,1;
-
+
;load B0 into r2
ldw r2, 0(r3);
;x & B0
and r1, r1, r2;
-
+
;x = (x & B0) + ((x >> 1) & B0);
add r0, r0, r1;