Arguments align !n !amount / .
Arguments Z.max !n !m / .
Definition field_type i m :=
match Ctypes.field_type i m with
| Errors.OK t => t
| _ => Tvoid
end.
Definition field_offset env i m :=
match Ctypes.field_offset env i m with
| Errors.OK ofs => ofs
| _ => 0
end.
Fixpoint field_offset_next_rec env i m ofs sz :=
match m with
| nil => 0
| (i0, t0) :: m0 =>
match m0 with
| nil => sz
| (_, t1) :: _ =>
if ident_eq i i0
then align (ofs + @sizeof env t0) (@alignof env t1)
else field_offset_next_rec env i m0 (align (ofs + @sizeof env t0) (@alignof env t1)) sz
end
end.
Definition field_offset_next env i m sz := field_offset_next_rec env i m 0 sz.

Lemma in_members_field_type: forall i m,
in_members i m ->
In (i, field_type i m) m.