temporary fix of geninfo that avoid an aliasing problem. The solution chosen is probably slower but safe.

Will for a better fix after the release.
This commit is contained in:
Sébastien Loriot 2011-02-25 16:24:10 +00:00
parent a155b2c4da
commit 0d4dba11fa
3 changed files with 14 additions and 0 deletions

View File

@ -20,6 +20,7 @@ find_package(Qt3-patched)
if ( CGAL_FOUND AND CGAL_Qt3_FOUND AND QT3_FOUND )
include_directories(BEFORE ../../include)
# use the Qt MOC preprocessor on classes that derives from QObject
include( Qt3Macros-patched )
qt3_generate_moc( "${CMAKE_CURRENT_SOURCE_DIR}/nef_2.cpp" nef_2.moc )

View File

@ -352,6 +352,7 @@ template <class pNT> class Polynomial :
/*{\Mop returns the sign of the limit process for $x \rightarrow \infty$
(the sign of the leading coefficient).}*/
{ const NT& leading_coeff = this->ptr()->coeff.back();
if (degree() < 0) return CGAL::ZERO;
if (leading_coeff < NT(0)) return (CGAL::NEGATIVE);
if (leading_coeff > NT(0)) return (CGAL::POSITIVE);
return CGAL::ZERO;
@ -1232,6 +1233,7 @@ Polynomial<NT> operator * (const Polynomial<NT>& p1,
const Polynomial<NT>& p2)
{
typedef typename Polynomial<NT>::size_type size_type;
if (p1.degree()<0 || p2.degree()<0) return p1;
CGAL_assertion(p1.degree()>=0 && p2.degree()>=0);
Polynomial<NT> p( size_type(p1.degree()+p2.degree()+1) );
// initialized with zeros

View File

@ -41,6 +41,7 @@ misuse memory problems occur.}*/
/*{\Moperations 2 1}*/
#ifdef CGAL_USE_FORMER_GENINFO
static void create(GenPtr& p)
/*{\Mstatic create a slot for an object of type |T| referenced
via |p|.}*/
@ -71,6 +72,16 @@ misuse memory problems occur.}*/
if (sizeof(T) > sizeof(GenPtr)) delete (T*) p;
p=0;
}
#else //CGAL_USE_FORMER_GENINFO
static void create(GenPtr& p) { p = (GenPtr) new T; }
static T& access(GenPtr& p) { return *(T*)p; }
static const T& const_access(const GenPtr& p)
{ return *(const T*)p; }
static void clear(GenPtr& p){
delete (T*) p;
p=0;
}
#endif //CGAL_USE_FORMER_GENINFO
};