Freeciv-3.2
|
Go to the source code of this file.
Data Structures | |
struct | dbv |
Macros | |
#define | TEST_BIT(val, bit_no) (((val) & (1u << (bit_no))) == (1u << (bit_no))) |
#define | MAX_DBV_LENGTH (4 * 1024 * 1024) |
#define | _BV_BYTES(bits) ((((bits) - 1) / 8) + 1) |
#define | _BV_BYTE_INDEX(bits) ((bits) / 8) |
#define | _BV_BITMASK(bit) (1u << ((bit) & 0x7)) |
#define | _BV_ASSERT(bv, bit) (void)0 |
#define | BV_ISSET(bv, bit) |
#define | BV_SET(bv, bit) |
#define | BV_CLR(bv, bit) |
#define | BV_SET_VAL(bv, bit, val) |
#define | BV_CLR_ALL(bv) |
#define | BV_SET_ALL(bv) |
#define | BV_CHECK_MASK(vec1, vec2) |
#define | BV_ISSET_ANY(vec) BV_CHECK_MASK(vec, vec) |
#define | BV_ARE_EQUAL(vec1, vec2) |
#define | BV_SET_ALL_FROM(vec_to, vec_from) |
#define | BV_CLR_ALL_FROM(vec_to, vec_from) |
#define | BV_DEFINE(name, bits) typedef struct { unsigned char vec[_BV_BYTES(bits)]; } name |
Definition at line 68 of file bitvector.h.
#define _BV_BYTE_INDEX | ( | bits | ) | ((bits) / 8) |
Definition at line 67 of file bitvector.h.
#define _BV_BYTES | ( | bits | ) | ((((bits) - 1) / 8) + 1) |
Definition at line 66 of file bitvector.h.
Definition at line 113 of file bitvector.h.
Definition at line 106 of file bitvector.h.
Definition at line 86 of file bitvector.h.
Definition at line 127 of file bitvector.h.
Definition at line 132 of file bitvector.h.
Definition at line 78 of file bitvector.h.
#define BV_ISSET_ANY | ( | vec | ) | BV_CHECK_MASK(vec, vec) |
Definition at line 109 of file bitvector.h.
Definition at line 81 of file bitvector.h.
Definition at line 120 of file bitvector.h.
Definition at line 91 of file bitvector.h.
#define MAX_DBV_LENGTH (4 * 1024 * 1024) |
Definition at line 63 of file bitvector.h.
Definition at line 28 of file bitvector.h.
bool bv_are_equal | ( | const unsigned char * | vec1, |
const unsigned char * | vec2, | ||
size_t | size1, | ||
size_t | size2 | ||
) |
Compare 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 302 of file bitvector.c.
Referenced by dbv_are_equal().
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 280 of file bitvector.c.
Referenced by dbv_isset_any().
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 351 of file bitvector.c.
Is content of static bitvector same as that of dynamic one. Comparison size is taken from the dynamic one.
Definition at line 205 of file bitvector.c.
Referenced by update_player_tile_knowledge().
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 329 of file bitvector.c.
Copy static bit vector content to dynamic bitvector. Static vector is assumed to be at least same size as the dynamic one.
Definition at line 244 of file bitvector.c.
Check if the two dynamic bitvectors are equal.
Definition at line 190 of file bitvector.c.
Returns the number of bits defined in a dynamic bitvector.
Definition at line 108 of file bitvector.c.
Referenced by sg_extras_get_dbv().
Clear the bit given by 'bit'.
Definition at line 167 of file bitvector.c.
Referenced by api_edit_tile_hide(), handle_tile_info(), map_clear_known(), and update_player_tile_knowledge().
Clear all bits.
Definition at line 179 of file bitvector.c.
Referenced by dbv_init(), dbv_resize(), make_rivers(), sg_load_map_known(), and sg_load_map_known().
Copy dynamic bit vector content from another.
Definition at line 222 of file bitvector.c.
Referenced by really_give_tile_info_from_player_to_player().
Debug a dynamic bitvector.
Definition at line 252 of file bitvector.c.
Destroy a dynamic bitvector.
Definition at line 95 of file bitvector.c.
Referenced by check_native_area(), is_city_channel_tile(), make_rivers(), player_destroy(), player_map_free(), player_tile_free(), and remove_city().
Initialize a dynamic bitvector of size 'bits'. 'bits' must be greater than 0 and lower than the maximal size given by MAX_DBV_LENGTH. The bitvector is set to all clear.
Definition at line 50 of file bitvector.c.
Referenced by check_native_area(), dbv_resize(), is_city_channel_tile(), make_rivers(), player_map_init(), player_tile_init(), and remove_city().
Check if the bit 'bit' is set.
Definition at line 120 of file bitvector.c.
Referenced by achievement_check(), check_native_area(), client_map_is_known_and_seen(), dbv_debug(), is_city_channel_tile(), make_rivers(), map_is_known(), objbind_get_value_from_object(), remove_city(), river_test_blocked(), sg_extras_get_dbv(), and tile_get_known().
Test if any bit is set.
Definition at line 132 of file bitvector.c.
Resize a dynamic bitvector. Create it if needed.
Definition at line 71 of file bitvector.c.
Referenced by client_player_maps_reset(), and dbv_copy().
Set the bit given by 'bit'.
Definition at line 144 of file bitvector.c.
Referenced by check_native_area(), handle_tile_info(), is_city_channel_tile(), make_river(), make_rivers(), map_set_known(), remove_city(), river_blockmark(), sg_bases_set_dbv(), sg_extras_set_dbv(), sg_extras_set_dbv(), sg_roads_set_dbv(), sg_special_set_dbv(), and update_player_tile_knowledge().
Set all bits.
Definition at line 156 of file bitvector.c.
Copy dynamic bit vector content to static bitvector. Static vector is assumed to be at least same size as the dynamic one.
Definition at line 235 of file bitvector.c.
Referenced by do_paradrop(), send_tile_info(), and sg_special_set_dbv().