| 183 | #define VLQ_MASK_BITS (VLQ_CONTINUATION_BIT - 1) |
| 184 | |
| 185 | txInteger fxSourceMapValue(txParser* parser, txString* p) |
| 186 | { |
| 187 | txInteger continuation, digit = 0, result = 0, shift = 0; |
| 188 | txString q = *p; |
| 189 | do { |
| 190 | char c = *q++; |
| 191 | if (('A' <= c) && (c <= 'Z')) |
| 192 | digit = c - 'A'; |
| 193 | else if (('a' <= c) && (c <= 'z')) |
| 194 | digit = c - 'a' + 26; |
| 195 | else if (('0' <= c) && (c <= '9')) |
| 196 | digit = c - '0' + 52; |
| 197 | else if (c == '+') |
| 198 | digit = 62; |
| 199 | else if (c == '/') |
| 200 | digit = 63; |
| 201 | else |
| 202 | fxReportParserError(parser, parser->states[0].line, "source map: unexpected character"); |
| 203 | continuation = digit & VLQ_CONTINUATION_BIT; |
| 204 | digit &= VLQ_MASK_BITS; |
| 205 | result += (digit << shift); |
| 206 | shift += VLQ_SHIFT; |
| 207 | } while (continuation); |
| 208 | *p = q; |
| 209 | shift = result >> 1; |
| 210 | return ((result & 1) == 1) ? -shift : shift; |
| 211 | } |
| 212 | |
| 213 | |
| 214 |
no test coverage detected