diff --git a/moo/lib/moo.h b/moo/lib/moo.h index 8d481c8..5c10568 100644 --- a/moo/lib/moo.h +++ b/moo/lib/moo.h @@ -240,10 +240,10 @@ typedef enum moo_method_type_t moo_method_type_t; #define MOO_OOP_IS_SMOOI(oop) (MOO_OOP_GET_TAG_LO(oop) == MOO_OOP_TAG_SMOOI) #define MOO_OOP_IS_SMPTR(oop) (MOO_OOP_GET_TAG_LO(oop) == MOO_OOP_TAG_SMPTR) -#define MOO_SMOOI_TO_OOP(num) ((moo_oop_t)((((moo_ooi_t)(num)) << MOO_OOP_TAG_BITS_LO) | MOO_OOP_TAG_SMOOI)) +#define MOO_SMOOI_TO_OOP(num) ((moo_oop_t)((((moo_oow_t)(moo_ooi_t)(num)) << MOO_OOP_TAG_BITS_LO) | MOO_OOP_TAG_SMOOI)) #define MOO_OOP_TO_SMOOI(oop) (((moo_ooi_t)oop) >> MOO_OOP_TAG_BITS_LO) /* -#define MOO_SMPTR_TO_OOP(num) ((moo_oop_t)((((moo_ooi_t)(num)) << MOO_OOP_TAG_BITS_LO) | MOO_OOP_TAG_SMPTR)) +#define MOO_SMPTR_TO_OOP(ptr) ((moo_oop_t)((((moo_oow_t)(ptr)) << MOO_OOP_TAG_BITS_LO) | MOO_OOP_TAG_SMPTR)) #define MOO_OOP_TO_SMPTR(oop) (((moo_ooi_t)oop) >> MOO_OOP_TAG_BITS_LO) */ #define MOO_SMPTR_TO_OOP(ptr) ((moo_oop_t)(((moo_oow_t)ptr) | MOO_OOP_TAG_SMPTR)) diff --git a/moo/lib/utf8.c b/moo/lib/utf8.c index 87c2796..c62a4a4 100644 --- a/moo/lib/utf8.c +++ b/moo/lib/utf8.c @@ -311,9 +311,13 @@ int moo_ucwidth (moo_uch_t uc) (uc >= 0xfe10 && uc <= 0xfe19) || /* Vertical forms */ (uc >= 0xfe30 && uc <= 0xfe6f) || /* CJK Compatibility Forms */ (uc >= 0xff00 && uc <= 0xff60) || /* Fullwidth Forms */ - (uc >= 0xffe0 && uc <= 0xffe6) || + (uc >= 0xffe0 && uc <= 0xffe6) + #if (MOO_SIZEOF_UCH_T > 2) + || (uc >= 0x20000 && uc <= 0x2fffd) || - (uc >= 0x30000 && uc <= 0x3fffd)) + (uc >= 0x30000 && uc <= 0x3fffd) + #endif + ) { return 2; }