Background
We need to convert a Javascript hashing algorithm into Perl code. Therefore, we need to convert Javascript's bitwise shift operators <<, >>, and >>> into Perl. So far, we have the algorithms for doing the conversion, but since Javascript bitwise shift operators operate on 32-bit integers, we also need to emulate this in Perl.
Python solution
Based on this post https://stackoverflow.com/a/41610348 we learned that we can do this in Python using ctypes. For example, to left-shift an integer by x bits:
import ctypes
print (ctypes.c_int(integer << x ^ 0).value)
Perl question
My understanding is that we need to use XS to do this. My question is whether anyone has a quick solution to implementing it. We don't know XS. We could start learning it, but from my impression of it, the learning curve is pretty high and it could take a while to gain any mastery of it. Of course, a non-XS solution would be ideal, if one exists. Any solutions or hints would be greatly appreciated.
Workaround
Since we have a Python solution already, we could implement this module in Python and then call it from Perl. Performance isn't really an issue, so this "hack" is acceptable, although somewhat undesirable. In other words, we would prefer to maintain the whole program (which consists of several modules) in Perl only.