Search code examples
pythongmpy

How could I implement a xor operation of big integers with gmpy?


I want to xor two big integers. Just installed the gmpy2 library, but no mpz_xor operation anywhere. Am I missing something?


Solution

  • Python has operator overloading, so they just made it ^. I would post a demo, but I only have access to gmpy 1.17, not gmpy2. Here's a code link showing the presence of an ^ overload, though.