Skip to content

Commit

Permalink
Fix bug in Unicode conversion for codepoints above 0x10000
Browse files Browse the repository at this point in the history
  • Loading branch information
Legimet authored and Vogtinator committed Jul 7, 2024
1 parent 00268d8 commit d5efef4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions luna.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ char *utf82unicode(char *in, char *end, unsigned long *c) {
return min(end, in + 2);
}
if ((*in & 0b11110000) == 0b11100000) {
*c = (*in & 0b00011111) << 12;
*c = (*in & 0b00001111) << 12;
if (end > in + 1)
*c |= (*(in + 1) & 0b00111111) << 6;
if (end > in + 2)
*c |= *(in + 2) & 0b00111111;
return min(end, in + 3);
}
if ((*in & 0b111110000) == 0b11110000) {
*c = (*in & 0b00011111) << 18;
if ((*in & 0b11111000) == 0b11110000) {
*c = (*in & 0b00000111) << 18;
if (end > in + 1)
*c |= (*(in + 1) & 0b00111111) << 12;
if (end > in + 2)
Expand Down

0 comments on commit d5efef4

Please sign in to comment.