in reply to Re^2: Trying to translate overflowing JS code to Perl
in thread Trying to translate overflowing JS code to Perl
-1234958336package Math32 { use Inline 'C', <<~'END'; #include <stdint.h> long calc(long input) { return (int32_t)((int32_t)input << 5); } END } use v5.36; say Math32::calc(1169367104);
Then all you need to do is write all the JS code in C, using int32_t variables and typecasts. If you want to declare the function parameter and return type as int32_t, you'd need to add it to the typemap, which is a hassle.
|
|---|