soft-fp: Fix _FP_TO_INT latent bug in overflow handling.
[platform/upstream/glibc.git] / soft-fp / extendsftf2.c
index a0d6270..f67d614 100644 (file)
@@ -1,6 +1,6 @@
 /* Software floating-point emulation.
    Return a converted to IEEE quad
-   Copyright (C) 1997,1999,2006 Free Software Foundation, Inc.
+   Copyright (C) 1997-2014 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson (rth@cygnus.com) and
                  Jakub Jelinek (jj@ultra.linux.cz).
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#define FP_NO_EXACT_UNDERFLOW
 #include "soft-fp.h"
 #include "single.h"
 #include "quad.h"
 
-TFtype __extendsftf2(SFtype a)
+TFtype
+__extendsftf2 (SFtype a)
 {
   FP_DECL_EX;
-  FP_DECL_S(A);
-  FP_DECL_Q(R);
+  FP_DECL_S (A);
+  FP_DECL_Q (R);
   TFtype r;
 
-  FP_INIT_ROUNDMODE;
-  FP_UNPACK_RAW_S(A, a);
+  FP_INIT_EXCEPTIONS;
+  FP_UNPACK_RAW_S (A, a);
 #if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q
-  FP_EXTEND(Q,S,4,1,R,A);
+  FP_EXTEND (Q, S, 4, 1, R, A);
 #else
-  FP_EXTEND(Q,S,2,1,R,A);
+  FP_EXTEND (Q, S, 2, 1, R, A);
 #endif
-  FP_PACK_RAW_Q(r, R);
+  FP_PACK_RAW_Q (r, R);
   FP_HANDLE_EXCEPTIONS;
 
   return r;