MCPcopy Create free account
hub / github.com/Snapchat/Valdi / encodeInteger

Function encodeInteger

src/valdi_modules/src/valdi/source_map/src/VLQ.ts:66–87  ·  view source on GitHub ↗
(num: number)

Source from the content-addressed store, hash-verified

64}
65
66function encodeInteger(num: number): string {
67 let result = '';
68
69 if (num < 0) {
70 num = (-num << 1) | 1;
71 } else {
72 num <<= 1;
73 }
74
75 do {
76 let clamped = num & 31;
77 num >>>= 5;
78
79 if (num > 0) {
80 clamped |= 32;
81 }
82
83 result += integerToChar[clamped];
84 } while (num > 0);
85
86 return result;
87}

Callers 1

encodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected