diff options
Diffstat (limited to 'src/vec2sw.c')
| -rw-r--r-- | src/vec2sw.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/vec2sw.c b/src/vec2sw.c index 0e1aec0..7e5e4d7 100644 --- a/src/vec2sw.c +++ b/src/vec2sw.c @@ -1,4 +1,5 @@ #include "vec2sw.h" +#include "log.h" #include "slidingwindow.h" #include "vec2.h" @@ -6,6 +7,10 @@ vec2d_sw_soa_t vec2d_sw_soa(smrt_arena_t *arena, u64 size) { vec2d_sw_soa_t vs = { .size=size }; vs.xs = SMRTA_ALLOC_SLIDINGWINDOW(arena, f64, size); vs.ys = SMRTA_ALLOC_SLIDINGWINDOW(arena, f64, size); + if (!(vs.xs && vs.ys)) { + log_error("Failed to allocate vec2d_sw_soa"); + return (vec2d_sw_soa_t){0}; + } return vs; } @@ -14,7 +19,7 @@ void vec2d_sw_soa_insert(vec2d_sw_soa_t sw_vs, vec2d_t v) { sw_insert(sw_vs.ys, (void*)&v.y); } -vec2d_soa_t vec2d_sw_soa_get(vec2d_sw_soa_t sw_vs) { +vec2d_soa_t ec2d_sw_soa_get(vec2d_sw_soa_t sw_vs) { return (vec2d_soa_t){ .size = sw_vs.xs->num_elements, .xs = SLIDINGWINDOW_GET(sw_vs.xs, f64), |