MCPcopy
hub / github.com/pyodide/pyodide / swapFunc

Function swapFunc

src/core/python2js_buffer.js:271–280  ·  view source on GitHub ↗
(buff)

Source from the content-addressed store, hash-verified

269 throw new Error(`Unexpected size ${itemsize}`);
270 }
271 function swapFunc(buff) {
272 let dataview = new DataView(buff);
273 let getFunc = dataview[getFuncName].bind(dataview);
274 let setFunc = dataview[setFuncName].bind(dataview);
275 for (let byte = 0; byte < dataview.byteLength; byte += itemsize) {
276 // Get value as little endian, set back as big endian.
277 setFunc(byte, getFunc(byte, true), false);
278 }
279 return buff;
280 }
281 return (buff) => new ArrayType(swapFunc(buff));
282};

Callers 1

Calls 1

bindMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…