[quote name='Brother Bob' timestamp='1350390907' post='4990694']
Your code doesn't match his. The bit index for the source and the destination are different variables; the source bit index is the loop index i, but the destination index is t which is stepped by one and only stepped for on-bits inside the if-statement. The behavior of his code is effectively: count the number of on-bits in every second bit index, and set that many bits in the destination. If the source contains 5 on-bits when counting every second bit, then the first 5 bits in the destination is set.
Although I'd say that his code and description doesn't convey the same message, and neither are very clear. A full description of the actual problem will help a lot.
Ah right. I actually assumed the t inside the if was a typo, since putting it outside in the for loop matches the description in the post and title
[/quote]
Actually, putting t++ in the loop itself makes yet another interpretation of the problem: it copies bit index 2*n to bit index n, since i increases by two and t increases by one each loop in that case.
The exact details here are important and, as I said, we need to know the actual problem. So far we've had two different descriptions, and yet another interpretation of it