..., like PR33360 does for strings.
Signed-off-by: Andrew C Aitchison <github@aitchison.me.uk>
case 4:
out += sprintf (out, "\\u%02x%02x%02x",
- ((in[0] & 0x07) << 6) | ((in[1] & 0x3c) >> 2),
- ((in[1] & 0x03) << 6) | ((in[2] & 0x3c) >> 2),
+ ((in[0] & 0x07) << 2) | ((in[1] & 0x30) >> 4),
+ ((in[1] & 0x0f) << 4) | ((in[2] & 0x3c) >> 2),
((in[2] & 0x03) << 6) | ((in[3] & 0x3f)));
break;
default:
case 4:
out += sprintf (out, "\\u%02x%02x%02x",
- ((in[0] & 0x07) << 6) | ((in[1] & 0x3c) >> 2),
- ((in[1] & 0x03) << 6) | ((in[2] & 0x3c) >> 2),
+ ((in[0] & 0x07) << 2) | ((in[1] & 0x30) >> 4),
+ ((in[1] & 0x0f) << 4) | ((in[2] & 0x3c) >> 2),
((in[2] & 0x03) << 6) | ((in[3] & 0x3f)));
break;
default:
if (width_remaining < 8)
break;
printf ("\\u%02x%02x%02x",
- ((bytes[0] & 0x07) << 6) | ((bytes[1] & 0x3c) >> 2),
- ((bytes[1] & 0x03) << 6) | ((bytes[2] & 0x3c) >> 2),
+ ((bytes[0] & 0x07) << 2) | ((bytes[1] & 0x30) >> 4),
+ ((bytes[1] & 0x0f) << 4) | ((bytes[2] & 0x3c) >> 2),
((bytes[2] & 0x03) << 6) | (bytes[3] & 0x3f));
break;