This commit is contained in:
Kovid Goyal 2014-03-28 13:19:03 +05:30
parent 157a2a3a69
commit 00038f3207

View File

@ -256,7 +256,7 @@ def decode_fvwi(byts, flag_size=4):
def decode_tbs(byts, flag_size=4):
'''
Trailing byte sequences for indexing consists of series of fvwi numbers.
This function reads the fvwi number and its associated flags. It them uses
This function reads the fvwi number and its associated flags. It then uses
the flags to read any more numbers that belong to the series. The flags are
the lowest 4 bits of the vwi (see the encode_fvwi function above).
@ -323,7 +323,8 @@ def align_block(raw, multiple=4, pad=b'\0'):
of 4.
'''
extra = len(raw) % multiple
if extra == 0: return raw
if extra == 0:
return raw
return raw + pad*(multiple - extra)
@ -370,7 +371,8 @@ def count_set_bits(num):
def to_base(num, base=32, min_num_digits=None):
digits = string.digits + string.ascii_uppercase
sign = 1 if num >= 0 else -1
if num == 0: return ('0' if min_num_digits is None else '0'*min_num_digits)
if num == 0:
return ('0' if min_num_digits is None else '0'*min_num_digits)
num *= sign
ans = []
while num: