inline pic_eq_p when nan boxing is enabled

This commit is contained in:
Yuichi Nishiwaki 2017-03-30 22:41:32 +09:00
parent e7953146c3
commit 2d8980b2d0
3 changed files with 20 additions and 17 deletions

View File

@ -5,21 +5,7 @@
#include "picrin.h" #include "picrin.h"
#include "object.h" #include "object.h"
#if PIC_NAN_BOXING #if !PIC_NAN_BOXING
bool
pic_eq_p(pic_state *PIC_UNUSED(pic), pic_value x, pic_value y)
{
return x.v == y.v;
}
bool
pic_eqv_p(pic_state *PIC_UNUSED(pic), pic_value x, pic_value y)
{
return x.v == y.v;
}
#else
bool bool
pic_eq_p(pic_state *PIC_UNUSED(pic), pic_value x, pic_value y) pic_eq_p(pic_state *PIC_UNUSED(pic), pic_value x, pic_value y)

View File

@ -51,6 +51,9 @@ typedef struct {
} pic_value; } pic_value;
#include "picrin/value.h" /* inline definitions */
/* /*
* state manipulation * state manipulation
*/ */
@ -89,8 +92,6 @@ bool pic_equal_p(pic_state *, pic_value, pic_value);
* number, boolean, character, string, bytevector, and userdata * number, boolean, character, string, bytevector, and userdata
*/ */
#include "picrin/value.h" /* inline definitions */
typedef struct { typedef struct {
const char *type_name; const char *type_name;
void (*dtor)(pic_state *, void *); void (*dtor)(pic_state *, void *);

View File

@ -242,6 +242,22 @@ pic_id_p(pic_state *pic, pic_value o)
return pic_type(pic, o) == PIC_TYPE_ID || pic_sym_p(pic, o); return pic_type(pic, o) == PIC_TYPE_ID || pic_sym_p(pic, o);
} }
#if PIC_NAN_BOXING
PIC_STATIC_INLINE bool
pic_eq_p(pic_state *PIC_UNUSED(pic), pic_value x, pic_value y)
{
return x.v == y.v;
}
PIC_STATIC_INLINE bool
pic_eqv_p(pic_state *PIC_UNUSED(pic), pic_value x, pic_value y)
{
return x.v == y.v;
}
#endif
#if defined(__cplusplus) #if defined(__cplusplus)
} }
#endif #endif