add pic_size_value
This commit is contained in:
parent
b3def908b6
commit
cf9d48a865
2
blob.c
2
blob.c
|
@ -83,7 +83,7 @@ pic_blob_bytevector_length(pic_state *pic)
|
|||
|
||||
pic_get_args(pic, "b", &bv);
|
||||
|
||||
return pic_int_value((int)bv->len);
|
||||
return pic_size_value(bv->len);
|
||||
}
|
||||
|
||||
static pic_value
|
||||
|
|
2
dict.c
2
dict.c
|
@ -213,7 +213,7 @@ pic_dict_dictionary_size(pic_state *pic)
|
|||
|
||||
pic_get_args(pic, "d", &dict);
|
||||
|
||||
return pic_int_value((int)pic_dict_size(pic, dict));
|
||||
return pic_size_value(pic_dict_size(pic, dict));
|
||||
}
|
||||
|
||||
static pic_value
|
||||
|
|
|
@ -189,6 +189,7 @@ static inline pic_value pic_undef_value();
|
|||
static inline pic_value pic_obj_value(void *);
|
||||
static inline pic_value pic_float_value(double);
|
||||
static inline pic_value pic_int_value(int);
|
||||
static inline pic_value pic_size_value(size_t);
|
||||
static inline pic_value pic_sym_value(pic_sym);
|
||||
static inline pic_value pic_char_value(char c);
|
||||
static inline pic_value pic_none_value();
|
||||
|
@ -323,6 +324,17 @@ pic_bool_value(bool b)
|
|||
return v;
|
||||
}
|
||||
|
||||
static inline pic_value
|
||||
pic_size_value(size_t s)
|
||||
{
|
||||
if (sizeof(unsigned) < sizeof(size_t)) {
|
||||
if (s > (size_t)INT_MAX) {
|
||||
return pic_float_value(s);
|
||||
}
|
||||
}
|
||||
return pic_int_value((int)s);
|
||||
}
|
||||
|
||||
#if PIC_NAN_BOXING
|
||||
|
||||
static inline pic_value
|
||||
|
|
2
pair.c
2
pair.c
|
@ -559,7 +559,7 @@ pic_pair_length(pic_state *pic)
|
|||
|
||||
pic_get_args(pic, "o", &list);
|
||||
|
||||
return pic_int_value(pic_length(pic, list));
|
||||
return pic_size_value(pic_length(pic, list));
|
||||
}
|
||||
|
||||
static pic_value
|
||||
|
|
2
string.c
2
string.c
|
@ -271,7 +271,7 @@ pic_str_string_length(pic_state *pic)
|
|||
|
||||
pic_get_args(pic, "s", &str);
|
||||
|
||||
return pic_int_value(pic_strlen(str));
|
||||
return pic_size_value(pic_strlen(str));
|
||||
}
|
||||
|
||||
static pic_value
|
||||
|
|
Loading…
Reference in New Issue