From 6bc702bd89c850a3287d8420793b1740c7503c5c Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Sat, 13 Sep 2014 16:50:06 +0900 Subject: [PATCH] [bugfix] signedness of ret val from pic_int --- include/picrin/value.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/picrin/value.h b/include/picrin/value.h index b7490fda..97c05c6f 100644 --- a/include/picrin/value.h +++ b/include/picrin/value.h @@ -63,7 +63,14 @@ pic_float(pic_value v) return u.f; } -#define pic_int(v) ((v) & 0xfffffffful) +static inline int +pic_int(pic_value v) +{ + union { int i; unsigned u; } u; + u.u = v & 0xfffffffful; + return u.i; +} + #define pic_sym(v) ((v) & 0xfffffffful) #define pic_char(v) ((v) & 0xfffffffful)