This commit is contained in:
@@ -13,34 +13,15 @@ typedef struct WpU128Hash {
|
||||
u64 hash[2];
|
||||
} WpU128Hash;
|
||||
|
||||
typedef enum WpHasherType {
|
||||
WP_HASH_TYPE_64,
|
||||
WP_HASH_TYPE_128,
|
||||
|
||||
COUNT_HASH_TYPES,
|
||||
} WpHasherType;
|
||||
|
||||
typedef u64 (*WpHasher64) (WpU8Stream *stream, void *hasher_data);
|
||||
typedef WpU128Hash (*WpHasher128)(WpU8Stream *stream, void *hasher_data);
|
||||
typedef WpU128Hash (*WpHashFunc)(WpU8Stream *stream, void *hasher_data);
|
||||
|
||||
typedef struct WpHasher {
|
||||
WpHasherType type;
|
||||
union {
|
||||
WpHasher64 hasher_64;
|
||||
WpHasher128 hasher_128;
|
||||
};
|
||||
WpHashFunc func;
|
||||
void *data;
|
||||
} WpHasher;
|
||||
|
||||
#ifdef WP_PLATFORM_CPP
|
||||
#define wpHasher64(HASHER) (WpHasher{ WP_HASH_TYPE_64, (HASHER) })
|
||||
#define wpHasher128(HASHER) (WpHasher{ WP_HASH_TYPE_128, (HASHER) })
|
||||
#else
|
||||
#define wpHasher64(HASHER) ((WpHasher){ .type = WP_HASH_TYPE_64, .hasher_64 = (HASHER) })
|
||||
#define wpHasher128(HASHER) ((WpHasher){ .type = WP_HASH_TYPE_128, .hasher_128 = (HASHER) })
|
||||
#endif
|
||||
|
||||
WpU128Hash wpHasherGetHash128(const WpHasher *hasher, WpU8Stream *stream, void *hasher_data);
|
||||
u64 wpHasherGetHash64 (const WpHasher *hasher, WpU8Stream *stream, void *hasher_data);
|
||||
WpU128Hash wpHasherGetHash128(const WpHasher *hasher, WpU8Stream *stream);
|
||||
u64 wpHasherGetHash64 (const WpHasher *hasher, WpU8Stream *stream);
|
||||
|
||||
#ifdef WP_PLATFORM_CPP
|
||||
END_C_LINKAGE
|
||||
|
||||
Reference in New Issue
Block a user