MCPcopy Index your code
hub / github.com/nodejs/node / testFastSwap32

Function testFastSwap32

test/parallel/test-buffer-swap-fast.js:16–23  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14}
15
16function testFastSwap32() {
17 const buf = Buffer.from([0x01, 0x02, 0x03, 0x04]);
18 const expected = Buffer.from([0x04, 0x03, 0x02, 0x01]);
19 const padded = Buffer.alloc(256);
20 buf.copy(padded);
21 padded.swap32();
22 assert.deepStrictEqual(padded.subarray(0, 4), expected);
23}
24
25function testFastSwap64() {
26 const buf = Buffer.from([0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08]);

Callers 1

Calls 4

allocMethod · 0.80
swap32Method · 0.80
copyMethod · 0.65
fromMethod · 0.45

Tested by

no test coverage detected