simplify inversion algorithm to improve readability by using bitunils inversion method
This commit is contained in:
parent
8019753a12
commit
0530d4b54f
|
@ -11,15 +11,9 @@ def divide(n, int_x, int_y, method):
|
|||
invert = False
|
||||
for i in x[::-1]:
|
||||
if invert:
|
||||
if i == '0':
|
||||
x_inv += '1'
|
||||
x_inv += bu.inv(i)
|
||||
else:
|
||||
x_inv += '0'
|
||||
else:
|
||||
if i == '0':
|
||||
x_inv += '0'
|
||||
else:
|
||||
x_inv += '1'
|
||||
x_inv += i
|
||||
|
||||
if i == '1':
|
||||
invert = True
|
||||
|
|
Loading…
Reference in New Issue