-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathTypes.h
104 lines (78 loc) · 2.52 KB
/
Types.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#pragma once
#include "Platform.h"
#include "Bitvec.h"
#include <memory.h>
#include <vector>
#include <map>
#include <set>
#include <stdio.h>
#include "Blob.h"
//-----------------------------------------------------------------------------
// If the optimizer detects that a value in a speed test is constant or unused,
// the optimizer may remove references to it or otherwise create code that
// would not occur in a real-world application. To prevent the optimizer from
// doing this we declare two trivial functions that either sink or source data,
// and bar the compiler from optimizing them.
void blackhole ( uint32_t x );
uint32_t whitehole ( void );
extern uint32_t g_verbose;
extern double g_confidence;
//-----------------------------------------------------------------------------
// We want to verify that every test produces the same result on every platform
// To do this, we hash the results of every test to produce an overall
// verification value for the whole test suite. If two runs produce the same
// verification value, then every test in both run produced the same results
extern uint32_t g_verify;
// Mix the given blob of data into the verification code
void MixVCode ( const void * blob, int len );
//-----------------------------------------------------------------------------
typedef void (*pfSeedState) ( const int seedbits, const void *seed, void *state );
typedef void (*pfHashWithState) ( const void *blob, const int len, const void *state, void *out );
typedef struct HashInfo
{
const char * name;
const char * desc;
int seedbits;
int statebits;
int hashbits;
uint32_t verification;
pfSeedState seed_state;
pfHashWithState hash_with_state;
} HashInfo;
struct ByteVec : public std::vector<uint8_t>
{
ByteVec ( const void * key, int len )
{
resize(len);
memcpy(&front(),key,len);
}
};
template< typename hashtype, typename keytype >
struct CollisionMap : public std::map< hashtype, std::vector<keytype> >
{
};
template< typename hashtype >
struct HashSet : public std::set<hashtype>
{
};
//-----------------------------------------------------------------------------
// Key-processing callback objects. Simplifies keyset testing a bit.
struct KeyCallback
{
KeyCallback() : m_count(0)
{
}
virtual ~KeyCallback()
{
}
virtual void operator() ( const void * key, int len )
{
m_count++;
}
virtual void reserve ( int keycount )
{
};
int m_count;
};
//-----------------------------------------------------------------------------
/* vim: set sts=2 sw=2 et: */