1
0
mirror of https://github.com/janet-lang/janet synced 2025-08-03 20:43:55 +00:00

Some more small changes to typedarray.c.

We want to compile janet with MSVC warning free.
This commit is contained in:
Calvin Rose 2019-03-07 22:12:06 -05:00
parent 021b71ad62
commit b57e530553

View File

@ -291,8 +291,9 @@ static int is_ta_anytype(Janet x) {
} }
static int is_ta_type(Janet x, JanetTArrayType type) { static int is_ta_type(Janet x, JanetTArrayType type) {
return (janet_checktype(x, JANET_ABSTRACT) && (type < TA_COUNT_TYPES) && return janet_checktype(x, JANET_ABSTRACT) &&
(janet_abstract_type(janet_unwrap_abstract(x)) == &ta_array_types[type])) ? 1 : 0; (type < TA_COUNT_TYPES) &&
(janet_abstract_type(janet_unwrap_abstract(x)) == &ta_array_types[type]);
} }
#define CASE_TYPE_INITIALIZE(type) case JANET_TARRAY_TYPE_##type : ta_init_##type(view,buffer,size,offset,stride); break #define CASE_TYPE_INITIALIZE(type) case JANET_TARRAY_TYPE_##type : ta_init_##type(view,buffer,size,offset,stride); break
@ -407,7 +408,7 @@ static Janet cfun_typed_array_properties(int32_t argc, Janet *argv) {
return janet_wrap_struct(janet_struct_end(props)); return janet_wrap_struct(janet_struct_end(props));
} else { } else {
JanetTArrayBuffer *buffer = janet_gettarray_buffer(argv, 0); JanetTArrayBuffer *buffer = janet_gettarray_buffer(argv, 0);
JanetKV *props = janet_struct_begin(3); JanetKV *props = janet_struct_begin(2);
janet_struct_put(props, janet_ckeywordv("size"), janet_wrap_number(buffer->size)); janet_struct_put(props, janet_ckeywordv("size"), janet_wrap_number(buffer->size));
janet_struct_put(props, janet_ckeywordv("big-endian"), janet_wrap_boolean(buffer->flags & TA_FLAG_BIG_ENDIAN)); janet_struct_put(props, janet_ckeywordv("big-endian"), janet_wrap_boolean(buffer->flags & TA_FLAG_BIG_ENDIAN));
return janet_wrap_struct(janet_struct_end(props)); return janet_wrap_struct(janet_struct_end(props));