Skip to content

Instantly share code, notes, and snippets.

@vinniefalco
Created March 24, 2020 04:31
Show Gist options
  • Save vinniefalco/9cb89e9eb5c8c2755b577b77a31571a2 to your computer and use it in GitHub Desktop.
Save vinniefalco/9cb89e9eb5c8c2755b577b77a31571a2 to your computer and use it in GitHub Desktop.
// utf16 escape
do_str4:
if(BOOST_JSON_LIKELY(
cs.remain() >= 4))
{
char d;
d = hex_digit(*cs);
if(d == -1)
{
ec_ = error::expected_hex_digit;
return;
}
u_ = d << 12;
++cs;
d = hex_digit(*cs);
if(d == -1)
{
ec_ = error::expected_hex_digit;
return;
}
u_ |= d << 8;
++cs;
d = hex_digit(*cs);
if(d == -1)
{
ec_ = error::expected_hex_digit;
return;
}
u_ |= d << 4;
++cs;
d = hex_digit(*cs);
if(d == -1)
{
ec_ = error::expected_hex_digit;
return;
}
u_ |= d;
++cs;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment