MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / decodeVLQ

Method decodeVLQ

tools/emsymbolizer.py:131–148  ·  view source on GitHub ↗
(string)

Source from the content-addressed store, hash-verified

129 vlq_map = {c: i for i, c in enumerate(chars)}
130
131 def decodeVLQ(string):
132 result = []
133 shift = 0
134 value = 0
135 for c in string:
136 try:
137 integer = vlq_map[c]
138 except ValueError as e:
139 raise Error(f'Invalid character ({c}) in VLQ') from e
140 value += (integer & 31) << shift
141 if integer & 32:
142 shift += 5
143 else:
144 negate = value & 1
145 value >>= 1
146 result.append(-value if negate else value)
147 value = shift = 0
148 return result
149
150 offset = 0
151 src = 0

Callers

nothing calls this directly

Calls 2

appendMethod · 0.80
ErrorClass · 0.70

Tested by

no test coverage detected