MCPcopy Create free account
hub / github.com/melonjs/melonJS / patchU32WriterPart

Function patchU32WriterPart

packages/melonjs/tests/aseprite-parser.spec.js:234–248  ·  view source on GitHub ↗
(w, byteOffset, value)

Source from the content-addressed store, hash-verified

232// alternately concat-then-patch, but patching the parts keeps construction
233// order simple.
234function patchU32WriterPart(w, byteOffset, value) {
235 let off = 0;
236 for (const part of w.parts) {
237 if (byteOffset >= off && byteOffset < off + part.length) {
238 new DataView(part.buffer, part.byteOffset, part.byteLength).setUint32(
239 byteOffset - off,
240 value,
241 true,
242 );
243 return;
244 }
245 off += part.length;
246 }
247 throw new Error("patchU32: offset out of range");
248}
249
250async function deflateZlib(bytes) {
251 const stream = new Response(bytes).body.pipeThrough(

Callers 7

writeLayerChunkFunction · 0.85
writeRawCelChunkFunction · 0.85
writeLinkedCelChunkFunction · 0.85
writeCompressedCelChunkFunction · 0.85
writeTagsChunkFunction · 0.85
writeFrameFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected