appendUnicodeEscape appends a `\uXXXX` escape sequence for the given code point to buf. Does NOT validate cp — callers use it for both valid BMP code points and for lone/invalid surrogates (which the parser must reject cleanly). cp must fit in 20 bits (the BMP range); higher bits are masked.
(buf *[]byte, cp int)
| 498 | // code points and for lone/invalid surrogates (which the parser must reject |
| 499 | // cleanly). cp must fit in 20 bits (the BMP range); higher bits are masked. |
| 500 | func appendUnicodeEscape(buf *[]byte, cp int) { |
| 501 | *buf = append(*buf, '\\', 'u', |
| 502 | hexChars[(cp>>12)&0xF], |
| 503 | hexChars[(cp>>8)&0xF], |
| 504 | hexChars[(cp>>4)&0xF], |
| 505 | hexChars[cp&0xF]) |
| 506 | } |
| 507 | |
| 508 | // ============================================================================= |
| 509 | // JSON-aware mutation operators |