mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-23 17:38:44 +00:00
Merge with develop
--HG-- branch : compatibility-develop
This commit is contained in:
commit
90c1a21ba6
2 changed files with 39 additions and 0 deletions
|
@ -166,6 +166,10 @@
|
|||
# define NL_ISO_CPP0X_AVAILABLE
|
||||
#endif
|
||||
|
||||
#if defined(NL_COMP_GCC) && (__cplusplus >= 201103L)
|
||||
# define NL_NO_EXCEPTION_SPECS
|
||||
#endif
|
||||
|
||||
// gcc 3.4 introduced ISO C++ with tough template rules
|
||||
//
|
||||
// NL_ISO_SYNTAX can be used using #if NL_ISO_SYNTAX or #if !NL_ISO_SYNTAX
|
||||
|
@ -407,12 +411,21 @@ typedef unsigned int uint; // at least 32bits (depend of processor)
|
|||
|
||||
#ifndef NL_CPU_X86_64
|
||||
// on x86_64, new and delete are already aligned on 16 bytes
|
||||
|
||||
#ifdef NL_NO_EXCEPTION_SPECS
|
||||
extern void *operator new(size_t size);
|
||||
extern void *operator new[](size_t size);
|
||||
extern void operator delete(void *p) noexcept;
|
||||
extern void operator delete[](void *p) noexcept;
|
||||
#else
|
||||
extern void *operator new(size_t size) throw(std::bad_alloc);
|
||||
extern void *operator new[](size_t size) throw(std::bad_alloc);
|
||||
extern void operator delete(void *p) throw();
|
||||
extern void operator delete[](void *p) throw();
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#else /* NL_HAS_SSE2 */
|
||||
|
||||
#define NL_DEFAULT_MEMORY_ALIGNMENT 4
|
||||
|
|
|
@ -82,6 +82,31 @@ extern "C" long _ftol2( double dblSource ) { return _ftol( dblSource ); }
|
|||
|
||||
#if defined(NL_HAS_SSE2) && !defined(NL_CPU_X86_64)
|
||||
|
||||
#ifdef NL_NO_EXCEPTION_SPECS
|
||||
void *operator new(size_t size)
|
||||
{
|
||||
void *p = aligned_malloc(size, NL_DEFAULT_MEMORY_ALIGNMENT);
|
||||
if (p == NULL) throw std::bad_alloc();
|
||||
return p;
|
||||
}
|
||||
|
||||
void *operator new[](size_t size)
|
||||
{
|
||||
void *p = aligned_malloc(size, NL_DEFAULT_MEMORY_ALIGNMENT);
|
||||
if (p == NULL) throw std::bad_alloc();
|
||||
return p;
|
||||
}
|
||||
|
||||
void operator delete(void *p) noexcept
|
||||
{
|
||||
aligned_free(p);
|
||||
}
|
||||
|
||||
void operator delete[](void *p) noexcept
|
||||
{
|
||||
aligned_free(p);
|
||||
}
|
||||
#else
|
||||
void *operator new(size_t size) throw(std::bad_alloc)
|
||||
{
|
||||
void *p = aligned_malloc(size, NL_DEFAULT_MEMORY_ALIGNMENT);
|
||||
|
@ -105,6 +130,7 @@ void operator delete[](void *p) throw()
|
|||
{
|
||||
aligned_free(p);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* NL_HAS_SSE2 */
|
||||
|
||||
|
|
Loading…
Reference in a new issue