fix broken pic_float_p

This commit is contained in:
Yuichi Nishiwaki 2013-11-07 12:17:16 +09:00
parent dcb3820054
commit ae376b4903
2 changed files with 1 additions and 39 deletions

View File

@ -43,7 +43,7 @@ typedef struct {
} pic_value;
#define pic_ptr(v) ((void *)((long long)0xffffffffffff & (long long)(v).u.data))
#define pic_vtype(v) (((v).u.type_ & 0xf0000)>>16)
#define pic_vtype(v) (((unsigned)0xfff00000 >= (v).u.type_) ? PIC_VTYPE_FLOAT : (((v).u.type_ & 0xf0000)>>16))
#define pic_init_value(v,vtype) (((v).u.type_ = ((unsigned int)0xfff00000|(unsigned int)((vtype)<<16))), (v).u.i = 0)
#else

View File

@ -3,14 +3,9 @@
#include "picrin.h"
#if PIC_NAN_BOXING
enum pic_tt
pic_type(pic_value v)
{
if ((int)0xfff00000 >= v.u.type_)
return PIC_TT_FLOAT;
switch (pic_vtype(v)) {
case PIC_VTYPE_NIL:
return PIC_TT_NIL;
@ -37,39 +32,6 @@ pic_type(pic_value v)
abort();
}
#else
enum pic_tt
pic_type(pic_value v)
{
switch (pic_vtype(v)) {
case PIC_VTYPE_NIL:
return PIC_TT_NIL;
case PIC_VTYPE_TRUE:
return PIC_TT_BOOL;
case PIC_VTYPE_FALSE:
return PIC_TT_BOOL;
case PIC_VTYPE_UNDEF:
return PIC_TT_UNDEF;
case PIC_VTYPE_FLOAT:
return PIC_TT_FLOAT;
case PIC_VTYPE_INT:
return PIC_TT_INT;
case PIC_VTYPE_SYMBOL:
return PIC_TT_SYMBOL;
case PIC_VTYPE_CHAR:
return PIC_TT_CHAR;
case PIC_VTYPE_EOF:
return PIC_TT_EOF;
case PIC_VTYPE_HEAP:
return ((struct pic_object *)v.u.data)->tt;
}
/* logic flaw (suppress warnings gcc will emit) */
abort();
}
#endif
const char *
pic_type_repr(enum pic_tt tt)
{