|
|
|
|
|
by bjourne
1419 days ago
|
|
The point of bit-twiddling is to produce a number n that is 1 or -1 if counter is divisible by 3 or 5 and 0 otherwise, and then add either mul(n, counter) or and(n, counter) to the result. It avoids branches which could shave off a few bytes depending on how branch instructions are encoded. Since we're golfing, we're not interested in speed, only program size. |
|
>> On an instruction set with that [pop count], I imagine it would be a useful trick though.