NAME ^

compilers/imcc/sets.c

DESCRIPTION ^

An implementation of sets -- used for tracking register usage.

Functions ^

Set *set_make

Creates a new Set object.

Set *set_make_full

Creates a new Set object of length items, setting them all to full.

void set_free

Frees the given Set and its allocated memory.

void set_clear

Clears all bits in the Set.

Set *set_copy

Copies the set s, returning a new set pointer.

int set_equal

Compares two sets for equality; sets are equal if they contain the same elements.

Raises a fatal error if the two Sets have different lengths.

void set_add

Adds to set s the element element.

unsigned int set_first_zero

Sets the first unused item in the set.

int set_contains

Checks whether the specified element is present in the specified Set argument. Returns 1 if it is, 0 otherwise.

Set *set_union

Computes the union of the two Set arguments, returning it as a new Set.

Raises a fatal error if the two Sets have different lengths.

Set *set_intersec

Creates a new Set object that is the intersection of the Set arguments (defined through the binary and operator.)

Raises a fatal error if the two Sets have different lengths.

void set_intersec_inplace

Performs a set intersection in place -- the first Set argument changes to contain the result.


parrot