fixed some stuff
This commit is contained in:
parent
5671ca3c1c
commit
efac07862c
@ -2,7 +2,7 @@
|
|||||||
#ifdef NO_OPEN_SSL
|
#ifdef NO_OPEN_SSL
|
||||||
#include <tomcrypt.h>
|
#include <tomcrypt.h>
|
||||||
|
|
||||||
#define DECLARE_DIGEST(name, _unused_, digestLength) \
|
#define DECLARE_DIGEST(name, digestLength) \
|
||||||
void digest::tomcrypt::name(const char* input, size_t length, uint8_t* result) { \
|
void digest::tomcrypt::name(const char* input, size_t length, uint8_t* result) { \
|
||||||
hash_state hash{}; \
|
hash_state hash{}; \
|
||||||
\
|
\
|
||||||
@ -11,7 +11,7 @@
|
|||||||
name ##_done(&hash, result); \
|
name ##_done(&hash, result); \
|
||||||
}
|
}
|
||||||
|
|
||||||
DECLARE_DIGEST(sha1, SHA1, SHA_DIGEST_LENGTH)
|
DECLARE_DIGEST(sha1, SHA_DIGEST_LENGTH)
|
||||||
DECLARE_DIGEST(sha256, SHA256, SHA256_DIGEST_LENGTH)
|
DECLARE_DIGEST(sha256, SHA256_DIGEST_LENGTH)
|
||||||
DECLARE_DIGEST(sha512, SHA512, SHA512_DIGEST_LENGTH)
|
DECLARE_DIGEST(sha512, SHA512_DIGEST_LENGTH)
|
||||||
#endif
|
#endif
|
||||||
|
@ -9,17 +9,21 @@ class spin_lock {
|
|||||||
inline void lock() {
|
inline void lock() {
|
||||||
uint8_t round = 0;
|
uint8_t round = 0;
|
||||||
while (locked.test_and_set(std::memory_order_acquire)) {
|
while (locked.test_and_set(std::memory_order_acquire)) {
|
||||||
|
#if false
|
||||||
/* waiting 'till its zero so we can try an exchanged again; Atomic exchanges have a huge bug overhead to deal with! */
|
/* waiting 'till its zero so we can try an exchanged again; Atomic exchanges have a huge bug overhead to deal with! */
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
while(locked._My_flag > 0) {
|
while(locked._My_flag > 0) {
|
||||||
#else
|
#else
|
||||||
while(locked._M_i) {
|
while(locked._M_i) {
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
//Yield when we're using this lock for a longer time, which we usually not doing
|
//Yield when we're using this lock for a longer time, which we usually not doing
|
||||||
if(round++ % 8 == 0)
|
if(round++ % 8 == 0)
|
||||||
std::this_thread::yield();
|
std::this_thread::yield();
|
||||||
|
#if false
|
||||||
}
|
}
|
||||||
}
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool try_lock() {
|
inline bool try_lock() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user