@@ -9,7 +9,35 @@
|
||||
BEGIN_C_LINKAGE
|
||||
#endif // !WP_PLATFORM_CPP
|
||||
|
||||
typedef void (*WpHasher)(WpU8Stream *stream, void *hasher_io);
|
||||
typedef struct {
|
||||
u64 hash[2];
|
||||
} WpU128Hash;
|
||||
|
||||
typedef enum {
|
||||
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 struct {
|
||||
WpHasherType type;
|
||||
union {
|
||||
WpHasher64 hasher_64;
|
||||
WpHasher128 hasher_128;
|
||||
};
|
||||
} WpHasher;
|
||||
|
||||
#ifdef WP_PLATFORM_CPP
|
||||
#define wpHasher64(HASHER) (WpHasher64{ WP_HASH_TYPE_64, (HASHER) })
|
||||
#define wpHasher128(HASHER) (WpHasher128{ WP_HASH_TYPE_128, (HASHER) })
|
||||
#else
|
||||
#define wpHasher64(HASHER) ((WpHasher64){ .type = WP_HASH_TYPE_64, .hasher_64 = (HASHER) })
|
||||
#define wpHasher128(HASHER) ((WpHasher128){ .type = WP_HASH_TYPE_128, .hasher_128 = (HASHER) })
|
||||
#endif
|
||||
|
||||
#ifdef WP_PLATFORM_CPP
|
||||
END_C_LINKAGE
|
||||
|
||||
Reference in New Issue
Block a user