start service tasks separately in-case platforms need to perform additional set-up...
[AROS.git] / workbench / libs / mathffp / spneg.c
blobf98297a44975d6b32f6e2cecac7646054be19141
1 /*
2 Copyright © 1995-2004, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include "mathffp_intern.h"
8 /*****************************************************************************
10 NAME */
12 AROS_LH1(float, SPNeg,
14 /* SYNOPSIS */
15 AROS_LHA(float, fnum1, D0),
17 /* LOCATION */
18 struct LibHeader *, MathBase, 10, Mathffp)
20 /* FUNCTION
21 Calculate fnum1*(-1)
23 INPUTS
25 RESULT
26 -fnum1
28 Flags:
29 zero : result is zero
30 negative : result is negative
31 overflow : 0
33 BUGS
35 INTERNALS
36 ALGORITHM:
37 Return zero if fnum == 0.
38 Otherwise flip the sign-bit.
40 *****************************************************************************/
42 AROS_LIBFUNC_INIT
44 D(kprintf("SPNeg(%08x)\n", fnum1));
45 if (0 == fnum1)
47 SetSR( Zero_Bit, Zero_Bit | Negative_Bit | Overflow_Bit);
48 return 0;
51 /* flip sign-bit */
52 fnum1 ^= FFPSign_Mask;
54 if((char) fnum1 < 0)
56 /* result is negative */
57 SetSR(Negative_Bit, Zero_Bit | Negative_Bit | Overflow_Bit);
59 else
61 /* result is positive */
62 SetSR(0, Zero_Bit | Overflow_Bit | Negative_Bit );
65 return fnum1;
67 AROS_LIBFUNC_EXIT