MCPcopy Create free account
hub / github.com/GamerHack/GamerHack.github.io / swap_bytes

Function swap_bytes

g2all/900/lapse.js:672–679  ·  view source on GitHub ↗
(x, byte_length)

Source from the content-addressed store, hash-verified

670
671function double_free_reqs2(sds) {
672 function swap_bytes(x, byte_length) {
673 let res = 0;
674 for (let i = 0; i < byte_length; i++) {
675 res |= ((x >> 8 * i) & 0xff) << 8 * (byte_length - i - 1);
676 }
677
678 return res >>> 0;
679 }
680
681 function htons(x) {
682 return swap_bytes(x, 2);

Callers 2

htonsFunction · 0.70
htonlFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected