This commit is contained in:
@@ -12,7 +12,7 @@
|
|||||||
BEGIN_C_LINKAGE
|
BEGIN_C_LINKAGE
|
||||||
#endif // !WP_PLATFORM_CPP
|
#endif // !WP_PLATFORM_CPP
|
||||||
|
|
||||||
#define WP_ARRAY_MAGIC (u64)0x57415f415252
|
#define WP_ARRAY_MAGIC wpU64Const(0x57415f415252)
|
||||||
|
|
||||||
#define _calcArrayCount(TYPE, ...) wpMiscUtilsVaArgsCount(TYPE, __VA_ARGS__)
|
#define _calcArrayCount(TYPE, ...) wpMiscUtilsVaArgsCount(TYPE, __VA_ARGS__)
|
||||||
#define _calcArrayCapacity(TYPE, ...) wpMiscUtilsU64RoundUpPow2(_calcArrayCount(TYPE, __VA_ARGS__) * 2)
|
#define _calcArrayCapacity(TYPE, ...) wpMiscUtilsU64RoundUpPow2(_calcArrayCount(TYPE, __VA_ARGS__) * 2)
|
||||||
|
|||||||
@@ -11,8 +11,8 @@
|
|||||||
BEGIN_C_LINKAGE
|
BEGIN_C_LINKAGE
|
||||||
#endif // !WP_PLATFORM_CPP
|
#endif // !WP_PLATFORM_CPP
|
||||||
|
|
||||||
#define WP_DBL_LIST_MAGIC (u64)0x57415f444c5354
|
#define WP_DBL_LIST_MAGIC wpU64Const(0x57415f444c5354)
|
||||||
#define WP_DBL_NODE_MAGIC (u64)0x57415f444e44
|
#define WP_DBL_NODE_MAGIC wpU64Const(0x57415f444e44)
|
||||||
|
|
||||||
typedef struct WpDblNode WpDblNode;
|
typedef struct WpDblNode WpDblNode;
|
||||||
|
|
||||||
|
|||||||
@@ -5,8 +5,6 @@
|
|||||||
#include "../../../common/assert/assert.h"
|
#include "../../../common/assert/assert.h"
|
||||||
#include "../../../common/misc/misc_utils.h"
|
#include "../../../common/misc/misc_utils.h"
|
||||||
|
|
||||||
#define _bigConstant(x) (x##LLU)
|
|
||||||
|
|
||||||
wp_intern inline void _validateIO(const WpMur3HasherIO *io);
|
wp_intern inline void _validateIO(const WpMur3HasherIO *io);
|
||||||
wp_intern inline u64 _fmix64(u64 k);
|
wp_intern inline u64 _fmix64(u64 k);
|
||||||
|
|
||||||
@@ -19,8 +17,8 @@ void wpX64Mur3Hasher128(WpU8Stream *bytes, void *hasher_io) {
|
|||||||
u64 h1 = io->seed;
|
u64 h1 = io->seed;
|
||||||
u64 h2 = io->seed;
|
u64 h2 = io->seed;
|
||||||
|
|
||||||
const u64 c1 = _bigConstant(0x87c37b91114253d5);
|
const u64 c1 = wpU64Const(0x87c37b91114253d5);
|
||||||
const u64 c2 = _bigConstant(0x4cf5ad432745937f);
|
const u64 c2 = wpU64Const(0x4cf5ad432745937f);
|
||||||
|
|
||||||
//----------
|
//----------
|
||||||
// body
|
// body
|
||||||
@@ -103,9 +101,9 @@ wp_intern inline void _validateIO(const WpMur3HasherIO *io) {
|
|||||||
|
|
||||||
wp_intern inline u64 _fmix64(u64 k) {
|
wp_intern inline u64 _fmix64(u64 k) {
|
||||||
k ^= k >> 33;
|
k ^= k >> 33;
|
||||||
k *= _bigConstant(0xff51afd7ed558ccd);
|
k *= wpU64Const(0xff51afd7ed558ccd);
|
||||||
k ^= k >> 33;
|
k ^= k >> 33;
|
||||||
k *= _bigConstant(0xc4ceb9fe1a85ec53);
|
k *= wpU64Const(0xc4ceb9fe1a85ec53);
|
||||||
k ^= k >> 33;
|
k ^= k >> 33;
|
||||||
|
|
||||||
return k;
|
return k;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
BEGIN_C_LINKAGE
|
BEGIN_C_LINKAGE
|
||||||
#endif // !WP_PLATFORM_CPP
|
#endif // !WP_PLATFORM_CPP
|
||||||
|
|
||||||
#define WP_MUR3_HASHER_MAGIC ((u64)0x57504d4841534833)
|
#define WP_MUR3_HASHER_MAGIC wpU64Const(0x57504d4841534833)
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
u64 hash[2];
|
u64 hash[2];
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
#include "../../../common/aliases/aliases.h"
|
#include "../../../common/aliases/aliases.h"
|
||||||
#include "../../../common/assert/assert.h"
|
#include "../../../common/assert/assert.h"
|
||||||
#include "../../../common/misc/misc_utils.h"
|
#include "../../../common/misc/misc_utils.h"
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
wp_intern inline void _siphash(WpStream *bytes, const WpSipHasherParams *params, u8 *out, u64 outlen);
|
wp_intern inline void _siphash(WpStream *bytes, const WpSipHasherParams *params, u8 *out, u64 outlen);
|
||||||
wp_intern inline void _validate128IO(const WpSipHasher128IO *io);
|
wp_intern inline void _validate128IO(const WpSipHasher128IO *io);
|
||||||
@@ -64,10 +63,10 @@ wp_intern inline void _siphash(WpStream *bytes, const WpSipHasherParams *params,
|
|||||||
|
|
||||||
wpRuntimeAssert((outlen == 8) || (outlen == 16), "outlen should be 8 or 16");
|
wpRuntimeAssert((outlen == 8) || (outlen == 16), "outlen should be 8 or 16");
|
||||||
|
|
||||||
u64 v0 = UINT64_C(0x736f6d6570736575);
|
u64 v0 = wpU64Const(0x736f6d6570736575);
|
||||||
u64 v1 = UINT64_C(0x646f72616e646f6d);
|
u64 v1 = wpU64Const(0x646f72616e646f6d);
|
||||||
u64 v2 = UINT64_C(0x6c7967656e657261);
|
u64 v2 = wpU64Const(0x6c7967656e657261);
|
||||||
u64 v3 = UINT64_C(0x7465646279746573);
|
u64 v3 = wpU64Const(0x7465646279746573);
|
||||||
u64 k0 = _u8To64LE(kk);
|
u64 k0 = _u8To64LE(kk);
|
||||||
u64 k1 = _u8To64LE(kk + 8);
|
u64 k1 = _u8To64LE(kk + 8);
|
||||||
u64 m;
|
u64 m;
|
||||||
|
|||||||
@@ -16,8 +16,8 @@
|
|||||||
BEGIN_C_LINKAGE
|
BEGIN_C_LINKAGE
|
||||||
#endif // !WP_PLATFORM_CPP
|
#endif // !WP_PLATFORM_CPP
|
||||||
|
|
||||||
#define WP_SIP_HASHER_128_MAGIC ((u64)0x5750534950313238)
|
#define WP_SIP_HASHER_128_MAGIC wpU64Const(0x5750534950313238)
|
||||||
#define WP_SIP_HASHER_64_MAGIC ((u64)0x57505349503634)
|
#define WP_SIP_HASHER_64_MAGIC wpU64Const(0x57505349503634)
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
u64 lo;
|
u64 lo;
|
||||||
|
|||||||
@@ -28,6 +28,11 @@ typedef uint16_t u16;
|
|||||||
typedef uint32_t u32;
|
typedef uint32_t u32;
|
||||||
typedef uint64_t u64;
|
typedef uint64_t u64;
|
||||||
|
|
||||||
|
#define wpU8Const UINT8_C
|
||||||
|
#define wpU16Const UINT16_C
|
||||||
|
#define wpU32Const UINT32_C
|
||||||
|
#define wpU64Const UINT64_C
|
||||||
|
|
||||||
typedef uint8_t b8;
|
typedef uint8_t b8;
|
||||||
|
|
||||||
#ifndef WP_PLATFORM_CPP
|
#ifndef WP_PLATFORM_CPP
|
||||||
@@ -47,6 +52,11 @@ typedef int16_t i16;
|
|||||||
typedef int32_t i32;
|
typedef int32_t i32;
|
||||||
typedef int64_t i64;
|
typedef int64_t i64;
|
||||||
|
|
||||||
|
#define wpI8Const INT8_C
|
||||||
|
#define wpI16Const INT16_C
|
||||||
|
#define wpI32Const INT32_C
|
||||||
|
#define wpI64Const INT64_C
|
||||||
|
|
||||||
typedef float f32;
|
typedef float f32;
|
||||||
typedef double f64;
|
typedef double f64;
|
||||||
typedef long double f128;
|
typedef long double f128;
|
||||||
|
|||||||
Reference in New Issue
Block a user