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
|
invert = False
|
||||||
for i in x[::-1]:
|
for i in x[::-1]:
|
||||||
if invert:
|
if invert:
|
||||||
if i == '0':
|
x_inv += bu.inv(i)
|
||||||
x_inv += '1'
|
|
||||||
else:
|
else:
|
||||||
x_inv += '0'
|
x_inv += i
|
||||||
else:
|
|
||||||
if i == '0':
|
|
||||||
x_inv += '0'
|
|
||||||
else:
|
|
||||||
x_inv += '1'
|
|
||||||
|
|
||||||
if i == '1':
|
if i == '1':
|
||||||
invert = True
|
invert = True
|
||||||
|
|
Loading…
Reference in New Issue