jspb.utils.joinFloat64 = function(bitsLow, bitsHigh) {
if (window.Uint32Array) {
bytes = Uint8Array.of(bitsLow, bitsHigh)
data = new Float64Array(bytes.buffer)
return data[0];
}
// ...
}
And vica-versa for the splitFloat method. This might increase readability (and depending on if it taps into the JS engine's native implementation, maybe even speed).
Happy to write the PR, just curious if it would be useful / appreciated!
Hi,
Has anyone thought of using JS typed arrays in the splitFloat and joinFloat methods for the JavaScript library (https://github.com/google/protobuf/blob/master/js/binary/utils.js#L388)?
One could imagine adding something like:
And vica-versa for the splitFloat method. This might increase readability (and depending on if it taps into the JS engine's native implementation, maybe even speed).
Happy to write the PR, just curious if it would be useful / appreciated!
Let me know,