cuoo/layout.h: Packing Memory-Layout Allocator
[cuoo: Dynamic Objects and Operations]

Data Structures

struct  cuoo_layout

Defines

#define cuoo_layout_type()   cuooP_layout_type
#define cuoo_layout_prefix(oml)   ((oml)->prefix)
#define cuoo_layout_bits_alloc_mask(oml)   ((oml)->alloc_mask)

Functions

cuoo_layout_t cuoo_layout_pack_bits (cuoo_layout_t prefix, cu_offset_t bitsize, cu_offset_t bitalign, cu_offset_t *bitoffset)
cuoo_layout_t cuoo_layout_product (cuoo_layout_t lyo0, cuoo_layout_t lyo1, cu_offset_t *bitoffset)
cuoo_layout_t cuoo_layout_union (cuoo_layout_t lyo0, cuoo_layout_t lyo1)
cu_offset_t cuoo_layout_size (cuoo_layout_t layout)
cu_offset_t cuoo_layout_bitsize (cuoo_layout_t lyo)
cu_offset_t cuoo_layout_align (cuoo_layout_t layout)
cu_offset_t cuoo_layout_bitalign (cuoo_layout_t layout)
cuoo_layout_t cuoo_layout_ptr ()
cuoo_layout_t cuoo_layout_void ()
void cuoo_layout_dump (cuoo_layout_t lyo, FILE *out)

Variables

cuoo_type_t cuooP_layout_type
cuoo_layout_t cuooP_layout_ptr
cuoo_layout_t cuooP_layout_void

Function Documentation

cu_offset_t cuoo_layout_align ( cuoo_layout_t  layout  ) 

The alignment of layout in bytes, rounded upwards.

cu_offset_t cuoo_layout_bitalign ( cuoo_layout_t  layout  ) 

The alignment of layout in bits. This is 1 for bitfields, otherwise 8, 16, etc up to the word size.

cu_offset_t cuoo_layout_bitsize ( cuoo_layout_t  lyo  ) 

The number of bits needed to represent lyo.

void cuoo_layout_dump ( cuoo_layout_t  lyo,
FILE *  out 
)

Dump of lyo to out for debugging.

cuoo_layout_t cuoo_layout_pack_bits ( cuoo_layout_t  prefix,
cu_offset_t  bitsize,
cu_offset_t  bitalign,
cu_offset_t *  bitoffset 
)

The layout of prefix with bitsize bits aligned on bitalign bits packed inside or after. The bit-offset of the allocated bits is stored in *bitoffset.

Precondition:
bitalign must be 1 (bitfield), 8 (a byte), or a larger power of two.
cuoo_layout_t cuoo_layout_product ( cuoo_layout_t  lyo0,
cuoo_layout_t  lyo1,
cu_offset_t *  bitoffset 
)

The layout of lyo0 with lyo1 packed inside or appended.

cuoo_layout_t cuoo_layout_ptr (  ) 

The layout of a pointer.

cu_offset_t cuoo_layout_size ( cuoo_layout_t  layout  ) 

The number of bytes needed to represent layout rounded up to a multiple of its alignment.

cuoo_layout_t cuoo_layout_union ( cuoo_layout_t  lyo0,
cuoo_layout_t  lyo1 
)

Return a layout which can hold the union of lyo0 and lyo1. Holes present in both arguments are preserved.

cuoo_layout_t cuoo_layout_void (  ) 

The empty layout, this may be represented by NULL.

Generated 2009-11-23 for culibs-0.25 using Doxygen. Maintained by Petter Urkedal.