diff options
author | lloyd <[email protected]> | 2008-09-15 16:41:08 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-09-15 16:41:08 +0000 |
commit | 8207944774d2e7f7c378d29f81b20abded0455f3 (patch) | |
tree | 3de5533228e6c1f67291db8757a8da983215fd98 /include | |
parent | 25ba9a0d49922338e5ebb7afb737ac3dbe67b4dd (diff) |
Slight cleanup in loop iteration
Diffstat (limited to 'include')
-rw-r--r-- | include/bit_ops.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/bit_ops.h b/include/bit_ops.h index ec3961dd3..594d130a4 100644 --- a/include/bit_ops.h +++ b/include/bit_ops.h @@ -67,8 +67,8 @@ inline u32bit hamming_weight(T n) 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4 }; u32bit weight = 0; - for(u32bit i = 0; i != 8*sizeof(T); i += 4) - weight += NIBBLE_WEIGHTS[(n >> i) & 0x0F]; + for(u32bit i = 0; i != 2*sizeof(T); ++i) + weight += NIBBLE_WEIGHTS[(n >> (4*i)) & 0x0F]; return weight; } |