15#define UNUSED( UNUSEDARG ) ( ( void ) UNUSEDARG )
19#define STRLEN( STRING ) ( sizeof( STRING ) - 1 )
22#define countof( array ) ( sizeof( array ) / sizeof *( array ) )
26#define cmpeq( cmp_retval ) ( ( cmp_retval ) == 0 )
35#define DEFINE_CMP_FUNCTION( TYPE ) \
36 LibraryDefined int cmp_##TYPE( const void *p1, const void *p2 ) \
38 TYPE val_1 = *( TYPE * ) p1; \
39 TYPE val_2 = *( TYPE * ) p2; \
41 if ( val_1 > val_2 ) \
43 if ( val_1 < val_2 ) \
67 uint64_t hash = 5381 * nbytes;
69 const byte *data_byte = (
byte * ) data;
70 for (
size_t i = 0; i < nbytes; ++i )
71 hash = ( hash << 5 ) + hash + data_byte[ i ];
Function and variable attributes.
#define LibraryDefined
Definition attributes.h:107
LibraryDefined uint64_t hash_func(const void *const data, const size_t nbytes)
Definition misc.h:65
#define DEFINE_CMP_FUNCTION(TYPE)
Definition misc.h:35