locale.library: correctly return the position of remaining datastream
[AROS.git] / workbench / libs / mathieeesingbas / ieeespneg.c
blob718ddeeea482105ef17773186479f52c929557ec
1 /*
2 Copyright © 1995-2004, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include "mathieeesingbas_intern.h"
8 /*****************************************************************************
10 NAME */
12 AROS_LH1(float, IEEESPNeg,
14 /* SYNOPSIS */
15 AROS_LHA(float, y, D0),
17 /* LOCATION */
18 struct LibHeader *, MathIeeeSingBasBase, 10, Mathieeesingbas)
20 /* FUNCTION
21 Switch the sign of the given ieeesp number
23 INPUTS
25 RESULT
28 Flags:
29 zero : result is zero
30 negative : result is negative
31 overflow : 0
33 BUGS
35 INTERNALS
36 ALGORITHM:
37 Return -0 if y == 0.
38 Otherwise flip the sign-bit.
40 *****************************************************************************/
42 AROS_LIBFUNC_INIT
44 if (0 == y || 0x80000000 == y)
46 SetSR( Zero_Bit, Zero_Bit | Negative_Bit | Overflow_Bit);
47 return (IEEESPSign_Mask ^ y);
50 /* flip sign-bit */
51 y ^= IEEESPSign_Mask;
53 if(y < 0)
55 /* result is negative */
56 SetSR(Negative_Bit, Zero_Bit | Negative_Bit | Overflow_Bit);
58 else
60 /* result is positive */
61 SetSR(0, Zero_Bit | Overflow_Bit | Negative_Bit );
64 return y;
66 AROS_LIBFUNC_EXIT