X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Fnumeric.cpp;h=582bfdcfb5be19229c56e7239217c3a3c0ff93b0;hp=cc72565a22b460b6c1a292e1091219d7dabb5057;hb=9507ddbf35326a15e98428f81b095d300b1a84cc;hpb=690cd58cc13ad5052eb5851c573984965d0c40c1 diff --git a/ginac/numeric.cpp b/ginac/numeric.cpp index cc72565a..582bfdcf 100644 --- a/ginac/numeric.cpp +++ b/ginac/numeric.cpp @@ -92,10 +92,16 @@ numeric::numeric(int i) : basic(&numeric::tinfo_static) // emphasizes efficiency. However, if the integer is small enough // we save space and dereferences by using an immediate type. // (C.f. ) + // The #if clause prevents compiler warnings on 64bit machines where the + // comparision is always true. +#if cl_value_len >= 32 + value = cln::cl_I(i); +#else if (i < (1L << (cl_value_len-1)) && i >= -(1L << (cl_value_len-1))) value = cln::cl_I(i); else value = cln::cl_I(static_cast(i)); +#endif setflag(status_flags::evaluated | status_flags::expanded); } @@ -107,10 +113,16 @@ numeric::numeric(unsigned int i) : basic(&numeric::tinfo_static) // emphasizes efficiency. However, if the integer is small enough // we save space and dereferences by using an immediate type. // (C.f. ) + // The #if clause prevents compiler warnings on 64bit machines where the + // comparision is always true. +#if cl_value_len >= 32 + value = cln::cl_I(i); +#else if (i < (1UL << (cl_value_len-1))) value = cln::cl_I(i); else value = cln::cl_I(static_cast(i)); +#endif setflag(status_flags::evaluated | status_flags::expanded); }