MCPcopy Create free account
hub / github.com/RtlZeroMemory/Rezi / writeResizeBatchV1

Function writeResizeBatchV1

packages/node/src/backend/nodeBackendInline.ts:168–194  ·  view source on GitHub ↗
(buf: ArrayBuffer, cols: number, rows: number)

Source from the content-addressed store, hash-verified

166const ZREV_RECORD_RESIZE = 5;
167
168function writeResizeBatchV1(buf: ArrayBuffer, cols: number, rows: number): number {
169 // Batch header (24) + RESIZE record (32) = 56 bytes.
170 const totalSize = 56;
171 if (buf.byteLength < totalSize) return 0;
172
173 const dv = new DataView(buf);
174 const timeMs = (Date.now() >>> 0) & 0xffff_ffff;
175
176 dv.setUint32(0, ZREV_MAGIC, true);
177 dv.setUint32(4, ZR_EVENT_BATCH_VERSION_V1, true);
178 dv.setUint32(8, totalSize, true);
179 dv.setUint32(12, 1, true); // event_count
180 dv.setUint32(16, 0, true); // batch_flags
181 dv.setUint32(20, 0, true); // reserved0
182
183 dv.setUint32(24, ZREV_RECORD_RESIZE, true);
184 dv.setUint32(28, 32, true); // record_size
185 dv.setUint32(32, timeMs, true);
186 dv.setUint32(36, 0, true); // flags
187
188 dv.setUint32(40, cols >>> 0, true);
189 dv.setUint32(44, rows >>> 0, true);
190 dv.setUint32(48, 0, true);
191 dv.setUint32(52, 0, true);
192
193 return totalSize;
194}
195
196async function loadNative(shimModule: string | undefined): Promise<NativeApi> {
197 const unwrap = (m: unknown): NativeApi => {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected