Skip to content

Commit

Permalink
fix: utf16 >>
Browse files Browse the repository at this point in the history
  • Loading branch information
zeromake committed Mar 5, 2024
1 parent dce59c1 commit dae82ad
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/charset/utf16.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ int32_t charset_ucs4_to_utf16(const uint32_t ch, uint8_t *out, bool be) {
} else {
uint32_t swap_ch = ch - 0x0010000;
if (be) {
static_write_u16_be(p, (swap_ch >> 10) + 0xd800);
static_write_u16_be(p, (swap_ch & 0x3ff) + 0xdc00);
static_write_u16_be(p, ((swap_ch >> 10) + 0xd800));
static_write_u16_be(p, ((swap_ch & 0x3ff) + 0xdc00));
} else {
static_write_u16_le(p, (swap_ch >> 10) + 0xd800);
static_write_u16_le(p, (swap_ch & 0x3ff) + 0xdc00);
static_write_u16_le(p, ((swap_ch >> 10) + 0xd800));
static_write_u16_le(p, ((swap_ch & 0x3ff) + 0xdc00));
}
}
return p - out;
Expand Down

0 comments on commit dae82ad

Please sign in to comment.