travis-ci
995 of 995 new or added lines in 14 files covered. (100.0%)
2920 of 3433 relevant lines covered (85.06%)
0.85 hits per line
|
def trailing_zeros(x): |
1✔ |
|
bits = 0
|
1✔ |
3 |
# convention for x == 0 => return 0
|
|
|
if x == 0: |
1✔ |
|
return 0 |
× |
6 |
|
|
|
if not (x & 0xFFFFFFFF): |
1✔ |
|
bits += 32
|
1✔ |
|
x >>= 32
|
1✔ |
|
if not (x & 0xFFFF): |
1✔ |
|
bits += 16
|
1✔ |
|
x >>= 16
|
1✔ |
|
if not (x & 0xFF): |
1✔ |
|
bits += 8
|
1✔ |
|
x >>= 8
|
1✔ |
|
if not (x & 0xF): |
1✔ |
|
bits += 4
|
1✔ |
|
x >>= 4
|
1✔ |
|
if not (x & 0x3): |
1✔ |
|
bits += 2
|
1✔ |
|
x >>= 2
|
1✔ |
|
if not (x & 1): |
1✔ |
|
bits += 1
|
1✔ |
|
x >>= 1
|
1✔ |
25 |
|
|
|
return bits
|
1✔ |