18 lines
418 B
OCaml
18 lines
418 B
OCaml
(** a memory layout *)
|
|
type t = {
|
|
size : int;
|
|
|
|
align_exp : char;
|
|
(** alignment = 1 << align_exp *)
|
|
}
|
|
|
|
val show : t -> string
|
|
|
|
val alignment : t -> int
|
|
|
|
(** appends a layout to this one, returns new layout and the offset *)
|
|
val push : t -> t -> (t * int) option
|
|
|
|
(** finishes a layout by inserting padding at the end to ensure alignment (might fail when overflowing) *)
|
|
val finish : t -> (t * int) option
|