The library deals with the mulle_data
structure, which contains a pointer to
raw bytes and the length of the data in bytes.
struct mulle_data
{
void *bytes;
size_t length;
};
mulle_data_make
creates amulle_data
structure with the given bytes and length.
struct mulle_data data = mulle_data_make_empty( "foo", 4);
mulle_data_make_empty
creates an emptymulle_data
structure, with aNULL
bytes pointer and a length of 0.
struct mulle_data data = mulle_data_make_empty()
mulle_data_make_invalid
creates an invalidmulle_data
structure, with aNULL
bytes pointer and a length of(size_t) -1
.
struct mulle_data data = mulle_data_make_invalid()
mulle_data_is_empty
checks if the givenmulle_data
structure is empty, i.e., if its length is 0.
struct mulle_data data = mulle_data_make_empty();
int is_empty = mulle_data_is_empty( data);
mulle_data_is_invalid
checks if the givenmulle_data
structure is invalid, i.e., if its length is(size_t) -1
.
struct mulle_data data = mulle_data_make_empty();
int is_valid = ! mulle_data_is_invalid( data)
mulle_data_hash
computes a hash value for the givenmulle_data
structure using either a 32-bit or 64-bit hash function, depending on the size ofuintptr_t
.
uintptr_t hash = mulle_data_hash( data);
mulle_data_hash_chained
computes a chained hash value for the givenmulle_data
structure using either a 32-bit or 64-bit hash function, depending on the size ofuintptr_t
. Thehash
parameter is used as a seed for the hash function.
uintptr_t hash = mulle_data_hash_chained( data, seed)