Advertisement
Guest User

Untitled

a guest
Dec 12th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. def RemXor(x,y):
  2. CopyY=y
  3. XSub=0
  4. YSub=0
  5. if x>=y:
  6. while x>=y:
  7. BitX=number_of_bits(x)
  8. BitY=number_of_bits(y)
  9. if BitX>BitY:
  10. YSub=BitX-BitY
  11. else:
  12. XSub=BitY-BitX
  13. CopyY=y<<YSub
  14. x=x<<XSub
  15. x=x^CopyY
  16. BitX=number_of_bits(x)
  17. BitY=number_of_bits(y)
  18. if BitX==BitY:
  19. x=x^y
  20. else:
  21. x=y-x
  22. return x
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement