simplify inversion algorithm to improve readability by using bitunils inversion method

This commit is contained in:
dymik739 2023-04-03 23:47:22 +03:00
parent 8019753a12
commit 0530d4b54f
1 changed files with 2 additions and 8 deletions

View File

@ -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:
x_inv += '0'
else: else:
if i == '0': x_inv += i
x_inv += '0'
else:
x_inv += '1'
if i == '1': if i == '1':
invert = True invert = True