aboutsummaryrefslogtreecommitdiffstats
path: root/libwc/ucs.h
diff options
context:
space:
mode:
Diffstat (limited to 'libwc/ucs.h')
-rw-r--r--libwc/ucs.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/libwc/ucs.h b/libwc/ucs.h
index 261351e..3a721a9 100644
--- a/libwc/ucs.h
+++ b/libwc/ucs.h
@@ -25,8 +25,8 @@
#define WC_C_UCS4_PLANE3 0x30000
#define wc_ucs_tag_to_ucs(c) ((c) & WC_C_UNICODE_MASK)
-#define wc_ucs_tag_to_tag(c) ((c) >> 24)
-#define wc_ucs_to_ucs_tag(c,tag) ((c) | ((tag) << 24))
+#define wc_ucs_tag_to_tag(c) (((c) >> 24) & 0xff)
+#define wc_ucs_to_ucs_tag(c,tag) ((c) | ((wc_uint32)((tag) & 0xff) << 24))
#define wc_ccs_ucs_to_ccs_ucs_tag(ccs) (WC_CCS_UCS_TAG | ((ccs) & ~WC_CCS_A_SET))
#define wc_ucs_to_utf16(ucs) \
((((((ucs) - WC_C_UCS4_PLANE1) >> 10) | WC_C_UCS2_SURROGATE) << 16) \