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

Function testFastSwap64

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

Source from the content-addressed store, hash-verified

23}
24
25function testFastSwap64() {
26 const buf = Buffer.from([0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08]);
27 const expected = Buffer.from([0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01]);
28 const padded = Buffer.alloc(256);
29 buf.copy(padded);
30 padded.swap64();
31 assert.deepStrictEqual(padded.subarray(0, 8), expected);
32}
33
34eval('%PrepareFunctionForOptimization(Buffer.prototype.swap16)');
35testFastSwap16();

Callers 1

Calls 4

allocMethod · 0.80
swap64Method · 0.80
copyMethod · 0.65
fromMethod · 0.45

Tested by

no test coverage detected