Here is my functional prototype code that is currently operational:
function int2str(int, bits) {
const str = int.toString(2);
var ret = '';
for (var i = 0; i < (bits - str.length); ++i) {
ret += '0';
}
ret += str;
return ret;
}
function high32(u64) {
return parseInt(int2str(u64, 64).substr(0, 32), 2);
}
function low32(u64) {
return parseInt(int2str(u64, 64).substr(32, 32), 2);
}
function combine(low, high) {
return parseInt(int2str(high, 32) + int2str(low, 32), 2);
}
Is there a more efficient way to achieve this without the use of strings?
(In Javascript, bitwise operators cast to a 32-bit integer, rendering them ineffective.)