Changed: Don't redefine new and delete operators if targetting x86_64

This commit is contained in:
kervala 2016-01-04 13:48:57 +01:00
parent 873ac7e727
commit 28ad88d698
2 changed files with 19 additions and 2 deletions

View file

@ -43,11 +43,25 @@
// This way we know about _HAS_TR1 and _STLPORT_VERSION
#include <string>
#if defined(HAVE_X86_64)
# define NL_CPU_INTEL
# define NL_CPU_X86_64
// x86_64 CPU always have SSE2 instructions
# ifndef NL_HAS_SSE2
# define NL_HAS_SSE2
# endif
#elif defined(HAVE_X86)
# define NL_CPU_INTEL
# define NL_CPU_X86
#endif
// Operating systems definition
#ifdef _WIN32
# define NL_OS_WINDOWS
# define NL_LITTLE_ENDIAN
# define NL_CPU_INTEL
# ifndef NL_CPU_INTEL
# define NL_CPU_INTEL
# endif
# ifndef _WIN32_WINNT
# define _WIN32_WINNT 0x0500 // Minimal OS = Windows 2000 (NeL is not supported on Windows 95/98)
# endif
@ -384,10 +398,13 @@ inline void aligned_free(void *ptr) { free(ptr); }
#define NL_DEFAULT_MEMORY_ALIGNMENT 16
#define NL_ALIGN_SSE2 NL_ALIGN(NL_DEFAULT_MEMORY_ALIGNMENT)
#ifndef NL_CPU_X86_64
// on x86_64, new and delete are already aligned on 16 bytes
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
#else /* NL_HAS_SSE2 */

View file

@ -80,7 +80,7 @@ extern "C" long _ftol2( double dblSource ) { return _ftol( dblSource ); }
#endif // !NL_COMP_MINGW
#ifdef NL_HAS_SSE2
#if defined(NL_HAS_SSE2) && !defined(NL_CPU_X86_64)
void *operator new(size_t size) throw(std::bad_alloc)
{