mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-10 01:09:50 +00:00
Fixed: Compilation in 32 bits with GCC (patch provided by Alistair Leslie-Hughes, thanks a lot)
--HG-- branch : develop
This commit is contained in:
parent
c16fe64f7e
commit
f23600cd30
2 changed files with 39 additions and 0 deletions
|
@ -166,6 +166,10 @@
|
||||||
# define NL_ISO_CPP0X_AVAILABLE
|
# define NL_ISO_CPP0X_AVAILABLE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(NL_COMP_GCC) && (__cplusplus >= 201103L)
|
||||||
|
# define NL_NO_EXCEPTION_SPECS
|
||||||
|
#endif
|
||||||
|
|
||||||
// gcc 3.4 introduced ISO C++ with tough template rules
|
// 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
|
// 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
|
#ifndef NL_CPU_X86_64
|
||||||
// on x86_64, new and delete are already aligned on 16 bytes
|
// 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 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();
|
||||||
extern void operator delete[](void *p) throw();
|
extern void operator delete[](void *p) throw();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#else /* NL_HAS_SSE2 */
|
#else /* NL_HAS_SSE2 */
|
||||||
|
|
||||||
#define NL_DEFAULT_MEMORY_ALIGNMENT 4
|
#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)
|
#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 *operator new(size_t size) throw(std::bad_alloc)
|
||||||
{
|
{
|
||||||
void *p = aligned_malloc(size, NL_DEFAULT_MEMORY_ALIGNMENT);
|
void *p = aligned_malloc(size, NL_DEFAULT_MEMORY_ALIGNMENT);
|
||||||
|
@ -105,6 +130,7 @@ void operator delete[](void *p) throw()
|
||||||
{
|
{
|
||||||
aligned_free(p);
|
aligned_free(p);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* NL_HAS_SSE2 */
|
#endif /* NL_HAS_SSE2 */
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue