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 "object.h"
#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
#if !PIC_NAN_BOXING
bool
pic_eq_p(pic_state *PIC_UNUSED(pic), pic_value x, pic_value y)

View File

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