MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / putLength

Method putLength

modules/crypt/etc/ber.js:174–186  ·  view source on GitHub ↗
(len)

Source from the content-addressed store, hash-verified

172 this.putc(tag);
173 }
174 putLength(len) {
175 if (len < 128)
176 this.putc(len);
177 else {
178 let lenlen = 1;
179 let x = len;
180 while (x >>>= 8)
181 lenlen++;
182 this.putc(lenlen | 0x80);
183 while (--lenlen >= 0)
184 this.putc(len >>> (lenlen << 3));
185 }
186 }
187 putChunk(c) {
188 if (this.#i + c.byteLength > this.#a.length)
189 this.morebuf(c.byteLength);

Callers 1

encodeMethod · 0.95

Calls 1

putcMethod · 0.95

Tested by

no test coverage detected