}
static void
+iter_start_field(struct gen_field_iterator *iter, struct gen_field *field)
+{
+ iter->field = field;
+
+ int group_member_offset = iter_group_offset_bits(iter, iter->group_iter);
+
+ iter->start_bit = group_member_offset + iter->field->start;
+ iter->end_bit = group_member_offset + iter->field->end;
+ iter->struct_desc = NULL;
+}
+
+static void
iter_advance_group(struct gen_field_iterator *iter)
{
if (iter->group->variable)
}
}
- iter->field = iter->group->fields;
+ iter_start_field(iter, iter->group->fields);
}
static bool
iter_advance_field(struct gen_field_iterator *iter)
{
if (iter_more_fields(iter)) {
- iter->field = iter->field->next;
+ iter_start_field(iter, iter->field->next);
} else {
if (!iter_more_groups(iter))
return false;
iter_advance_group(iter);
}
-
- if (iter->field->name)
- snprintf(iter->name, sizeof(iter->name), "%s", iter->field->name);
- else
- memset(iter->name, 0, sizeof(iter->name));
-
- int group_member_offset = iter_group_offset_bits(iter, iter->group_iter);
-
- iter->start_bit = group_member_offset + iter->field->start;
- iter->end_bit = group_member_offset + iter->field->end;
- iter->struct_desc = NULL;
-
return true;
}
/* Initial condition */
if (!iter->field) {
if (iter->group->fields)
- iter->field = iter->group->fields;
+ iter_start_field(iter, iter->group->fields);
else
- iter->field = iter->group->next->fields;
+ iter_start_field(iter, iter->group->next->fields);
bool result = iter_decode_field(iter);
if (iter->p_end)