From 723ceb272d15b6a76e01fba09f88a13f629bc4b6 Mon Sep 17 00:00:00 2001 From: mykola2312 <49044616+mykola2312@users.noreply.github.com> Date: Tue, 3 May 2022 07:45:35 +0300 Subject: [PATCH] value 5: implement value_size, value_array_size, value_offset and value_get --- struct.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/struct.c b/struct.c index cb259c9..e93b28b 100644 --- a/struct.c +++ b/struct.c @@ -15,7 +15,7 @@ uint value_size(struct cu_struct_s* st, uint idx, const void* in) { case NoValue: return 0; case Sequence: return value->sequence.size; - //case Array: + case Array: return value_array_size(st, idx, in); case Int8: return VALUE_INT8_SIZE; case Int16: return VALUE_INT16_SIZE; case Int32: return VALUE_INT32_SIZE; @@ -57,10 +57,10 @@ void value_value(struct cu_struct_s* st, uint idx, const void* in, void* out) uint value_array_size(struct cu_struct_s* st, uint idx, const void* in) { - union intvalue_u size; + union intvalue_u count = {0}; struct cu_value_s* value = &st->members[idx]; if (value->array.index) - { - //struct_value(st, value->array.count, in, (uint8_t*)) - } + value_get(st, value->array.count, in, &count); + else count.int32 = value->array.count; + return value->array.item * count.int32; }