mirror of
https://github.com/shadps4-emu/ext-cryptopp.git
synced 2024-11-23 09:59:42 +00:00
Revert "Hid inline assembly behind a macro". The MEMORY_BARRIER code is OK, and the use of inline assembly code is OK to tame the optimizer is OK; but its confusing because the interactions are not readily apparent.
This commit is contained in:
parent
390d27b6cd
commit
b44546be11
11
misc.h
11
misc.h
@ -61,17 +61,6 @@
|
||||
# pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
|
||||
# pragma intrinsic(_ReadWriteBarrier)
|
||||
# define MEMORY_BARRIER() _ReadWriteBarrier()
|
||||
#elif defined(_INTEL_COMPILER)
|
||||
# define MEMORY_BARRIER() __memory_barrier()
|
||||
#elif defined(__GNUC__) || defined(__clang__)
|
||||
# define MEMORY_BARRIER() __asm__ __volatile__ ("" ::: "memory")
|
||||
#else
|
||||
# define MEMORY_BARRIER()
|
||||
#endif
|
||||
|
||||
NAMESPACE_BEGIN(CryptoPP)
|
||||
|
||||
// ************** compile-time assertion ***************
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
#include "config.h"
|
||||
#include "stdcpp.h"
|
||||
#include "misc.h"
|
||||
#include "trap.h"
|
||||
|
||||
NAMESPACE_BEGIN(CryptoPP)
|
||||
@ -52,8 +51,11 @@ template <class T> simple_ptr<T>::~simple_ptr()
|
||||
delete m_p;
|
||||
m_p = NULL;
|
||||
|
||||
// https://github.com/weidai11/cryptopp/issues/6
|
||||
MEMORY_BARRIER();
|
||||
#ifdef __GNUC__
|
||||
// From Andrew Haley (GCC Dev), to tame the optimizer so the assignment is always performed.
|
||||
// See "Disable optimizations in one function" on the GCC mailing list.
|
||||
asm volatile ("" : : : "memory");
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class T> class member_ptr
|
||||
|
Loading…
Reference in New Issue
Block a user