Mescal
Loading...
Searching...
No Matches
type_boolarray.h File Reference

Implementation of Boolean arrays. More...

#include "tools.h"

Go to the source code of this file.

Classes

struct  barray
 Type used to represent an array of Booleans. More...
 

Functions

barraycreate_barray (uint)
 Creation of an array of Booleans.
 
uint getsize_barray (barray *)
 Computation of the size of an array of Booleans.
 
void delete_barray (barray *)
 Release of an array of Booleans.
 
void settrue_barray (barray *, uint)
 Sets a cell to true in an array of Booleans.
 
void setfalse_barray (barray *, uint)
 Sets a cell to false in an array of Booleans.
 
bool getval_barray (barray *, uint)
 Returns the value of a cell in an array of Booleans.
 
barrayor_barray (barray *, barray *)
 Bitwise disjunction of two Boolean arrays of the same size.
 
void or_barray_mod (barray *, barray *)
 Bitwise disjunction of two Boolean arrays of the same size. Modifies the first array.
 
barrayand_barray (barray *, barray *)
 Bitwise conjunction of two Boolean arrays of the same size.
 
void and_barray_mod (barray *, barray *)
 Bitwise conjunction of two Boolean arrays of the same size. Modifies the first array.
 
barraycopy_barray (barray *)
 Copy of an array of Booleans.
 

Detailed Description

Implementation of Boolean arrays.

Function Documentation

◆ and_barray()

barray * and_barray ( barray * a1,
barray * a2 )

Bitwise conjunction of two Boolean arrays of the same size.

Attention
If the arrays have distinct size, a NULL pointer is returned.
Returns
A new array containing the bitwise conjunction.
Parameters
a1The first array of Booleans.
a2The second array of Booleans.

◆ and_barray_mod()

void and_barray_mod ( barray * a1,
barray * a2 )

Bitwise conjunction of two Boolean arrays of the same size. Modifies the first array.

Attention
If the arrays have distinct size, the first array is not modified.
Parameters
a1The first array of Booleans.
a2The second array of Booleans.

◆ copy_barray()

barray * copy_barray ( barray * a)

Copy of an array of Booleans.

Returns
The copy.
Parameters
aThe array of Booleans.

◆ create_barray()

barray * create_barray ( uint size)

Creation of an array of Booleans.

Remarks
All cells are initialized to the false value.
Returns
The array.
Parameters
sizeThe size

◆ delete_barray()

void delete_barray ( barray * a)

Release of an array of Booleans.

Parameters
aThe array of Booleans.

◆ getsize_barray()

uint getsize_barray ( barray * a)

Computation of the size of an array of Booleans.

Returns
The size of the array.
Parameters
aThe array of Booleans.

◆ getval_barray()

bool getval_barray ( barray * a,
uint i )

Returns the value of a cell in an array of Booleans.

Returns
The Boolean value.
Parameters
aThe array of Booleans.
iThe cell.

◆ or_barray()

barray * or_barray ( barray * a1,
barray * a2 )

Bitwise disjunction of two Boolean arrays of the same size.

Attention
If the arrays have distinct size, a NULL pointer is returned.
Returns
A new array containing the bitwise disjunction.
Parameters
a1The first array of Booleans.
a2The second array of Booleans.

◆ or_barray_mod()

void or_barray_mod ( barray * a1,
barray * a2 )

Bitwise disjunction of two Boolean arrays of the same size. Modifies the first array.

Attention
If the arrays have distinct size, the first array is not modified.
Parameters
a1The first array of Booleans.
a2The second array of Booleans.

◆ setfalse_barray()

void setfalse_barray ( barray * a,
uint i )

Sets a cell to false in an array of Booleans.

Parameters
aThe array of Booleans.
iThe cell.

◆ settrue_barray()

void settrue_barray ( barray * a,
uint i )

Sets a cell to true in an array of Booleans.

Parameters
aThe array of Booleans.
iThe cell.