]> www.ginac.de Git - cln.git/commitdiff
Avoid "integer overflow in expression" warning.
authorBruno Haible <bruno@clisp.org>
Sun, 27 Oct 2019 15:06:45 +0000 (16:06 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 27 Oct 2019 17:09:37 +0000 (18:09 +0100)
src/float/sfloat/elem/cl_SF_futrunc.cc

index 0a422a0371e5be54fd208355e7292182497879b8..44f8d2b80d6732afbae5a26559ebd81d172d502d 100644 (file)
@@ -29,8 +29,8 @@ const cl_SF futruncate (const cl_SF& x)
       if (uexp <= SF_exp_mid) // e<=0 ?
         { // Exponent auf 1, Mantisse auf .1000...000 setzen.
           return cl_SF_from_word(
-            (x.word & ~(bit(SF_exp_len+SF_exp_shift)-bit(SF_exp_shift)
-                        + bit(SF_mant_len+SF_mant_shift)-bit(SF_mant_shift)))
+            (x.word & ~(((bit(SF_exp_len)-1)<<SF_exp_shift)
+                        + ((bit(SF_mant_len)-1)<<SF_mant_shift)))
             | ((cl_uint)(SF_exp_mid+1) << SF_exp_shift)
             | ((cl_uint)0 << SF_mant_shift)
             );