What is the equivalent of _byteswap_ulong in JavaScript?
I'm currently using the following C++ code:
int tag = 2832779;
tag = _byteswap_ulong(tag) >> 8;
The result of tag is 9124193.
I tried doing the same in JavaScript:
var tag = 2832779;
tag = (((tag >> 24) & 0x000000FF) | ((tag >> 8) & 0x0000FF00) | ((tag << 8) & 0x00FF0000) | ((tag << 24) & 0xFF000000)) >> 8;
However, the result of tag (in JS) is -7653077.
Is it possible to swap bytes in JavaScript the same way it's possible in C++?
Thanks a lot!
Aucun commentaire:
Enregistrer un commentaire