Jul-18-2023, 01:48 PM
(This post was last modified: Jul-18-2023, 01:48 PM by AlexanderWulf.)
Well, thanks for the info. That's all interesting, but I think it is not what I need.
Look, I have "reference" code in C. That's just a simple C function. I could add a main() function to call the function that implements the algorithm and then compile an .exe file. But I don't see how that helps me with the Python project, or how I would invoke that from the Python code. And, even if I somehow could create an .exe (or .dll) file that can be invoked from Python code, it would not really solve the task. We need an implementation of the algorithm as "portable" Python code that works on different platforms and, ideally, with all Python interpreters (not only CPython). I think porting the code actually shouldn't be too hard, if it wasn't for the "mod 2^64" arithmetic stuff. So, thanks again for your suggestions so far, but can we please discuss the original question?
I mean, a lot of algorithms, like hash functions and stuff, are defined with "fixed-size" (wrapping) arithmetic. So, this doesn't seem like an unusual requirement. How is it usually done in Python?
Thank you!
Look, I have "reference" code in C. That's just a simple C function. I could add a main() function to call the function that implements the algorithm and then compile an .exe file. But I don't see how that helps me with the Python project, or how I would invoke that from the Python code. And, even if I somehow could create an .exe (or .dll) file that can be invoked from Python code, it would not really solve the task. We need an implementation of the algorithm as "portable" Python code that works on different platforms and, ideally, with all Python interpreters (not only CPython). I think porting the code actually shouldn't be too hard, if it wasn't for the "mod 2^64" arithmetic stuff. So, thanks again for your suggestions so far, but can we please discuss the original question?
Quote: So, given that we need to port the algorithm to Python, is there any recommended/idiomatic way to do "fixed-size" (wrapping) arithmetic ???
I mean, a lot of algorithms, like hash functions and stuff, are defined with "fixed-size" (wrapping) arithmetic. So, this doesn't seem like an unusual requirement. How is it usually done in Python?
Thank you!