Skip to content

Commit

Permalink
Improve armpack_decode_to_map
Browse files Browse the repository at this point in the history
  • Loading branch information
luboslenco committed Sep 26, 2024
1 parent e43fb21 commit 15b9e4c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion sources/iron_armpack.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ static uint8_t read_u8() {

static int16_t read_i16() {
int16_t i16 = *(int16_t *)(encoded + ei);
ei += 4;
ei += 2;
return i16;
}

Expand Down Expand Up @@ -661,6 +661,13 @@ any_map_t *_armpack_decode_to_map() {
}
any_map_set(result, key, array);
}
else if (element_flag == 0xd1) { // i16
i16_array_t *array = i16_array_create(array_count);
for (int j = 0; j < array_count; j++) {
array->buffer[j] = read_i16();
}
any_map_set(result, key, array);
}
else if (element_flag == 0xc4) { // u8
u8_array_t *array = u8_array_create(array_count);
for (int j = 0; j < array_count; j++) {
Expand Down

0 comments on commit 15b9e4c

Please sign in to comment.