Freeciv21
Develop your civilization from humble roots to a global empire
bitvector.cpp File Reference
#include <QBitArray>
#include "bitvector.h"
+ Include dependency graph for bitvector.cpp:

Go to the source code of this file.

Functions

bool bv_check_mask (const unsigned char *vec1, const unsigned char *vec2, size_t size1, size_t size2)
 Return whether two vectors: vec1 and vec2 have common bits. More...
 
bool bv_are_equal (const unsigned char *vec1, const unsigned char *vec2, size_t size1, size_t size2)
 Compares elements of two bitvectors. More...
 
void bv_set_all_from (unsigned char *vec_to, const unsigned char *vec_from, size_t size_to, size_t size_from)
 Set everything that is true in vec_from in vec_to. More...
 
void bv_clr_all_from (unsigned char *vec_to, const unsigned char *vec_from, size_t size_to, size_t size_from)
 Clear everything that is true in vec_from in vec_to. More...
 
bool is_any_set (QBitArray &ba)
 

Function Documentation

◆ bv_are_equal()

bool bv_are_equal ( const unsigned char *  vec1,
const unsigned char *  vec2,
size_t  size1,
size_t  size2 
)

Compares elements of two bitvectors.

Both vectors are expected to have same number of elements, i.e. , size1 must be equal to size2.

Definition at line 51 of file bitvector.cpp.

◆ bv_check_mask()

bool bv_check_mask ( const unsigned char *  vec1,
const unsigned char *  vec2,
size_t  size1,
size_t  size2 
)

Return whether two vectors: vec1 and vec2 have common bits.

I.e. (vec1 & vec2) != 0.

Don't call this function directly, use BV_CHECK_MASK macro instead. Don't call this function with two different bitvectors.

Definition at line 31 of file bitvector.cpp.

◆ bv_clr_all_from()

void bv_clr_all_from ( unsigned char *  vec_to,
const unsigned char *  vec_from,
size_t  size_to,
size_t  size_from 
)

Clear everything that is true in vec_from in vec_to.

Stuff that already is false in vec_to aren't touched.

Both vectors are expected to have same number of elements, i.e. , size1 must be equal to size2.

Don't call this function directly, use BV_CLR_ALL_FROM macro instead.

Definition at line 99 of file bitvector.cpp.

◆ bv_set_all_from()

void bv_set_all_from ( unsigned char *  vec_to,
const unsigned char *  vec_from,
size_t  size_to,
size_t  size_from 
)

Set everything that is true in vec_from in vec_to.

Stuff that already is true in vec_to aren't touched. (Bitwise inclusive OR assignment)

Both vectors are expected to have same number of elements, i.e. , size1 must be equal to size2.

Don't call this function directly, use BV_SET_ALL_FROM macro instead.

Definition at line 77 of file bitvector.cpp.

◆ is_any_set()

bool is_any_set ( QBitArray &  ba)

Definition at line 112 of file bitvector.cpp.

Referenced by helptext_unit().