summaryrefslogtreecommitdiffstats
path: root/private/crt32/misc/abs.c
diff options
context:
space:
mode:
authorAdam <you@example.com>2020-05-17 05:51:50 +0200
committerAdam <you@example.com>2020-05-17 05:51:50 +0200
commite611b132f9b8abe35b362e5870b74bce94a1e58e (patch)
treea5781d2ec0e085eeca33cf350cf878f2efea6fe5 /private/crt32/misc/abs.c
downloadNT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.gz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.bz2
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.lz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.xz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.zst
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.zip
Diffstat (limited to 'private/crt32/misc/abs.c')
-rw-r--r--private/crt32/misc/abs.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/private/crt32/misc/abs.c b/private/crt32/misc/abs.c
new file mode 100644
index 000000000..cd5f3d1be
--- /dev/null
+++ b/private/crt32/misc/abs.c
@@ -0,0 +1,51 @@
+/***
+*abs.c - find absolute value
+*
+* Copyright (c) 1985-1991, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* defines abs() - find the absolute value of an int.
+*
+*Revision History:
+* 04-22-87 JMB added function pragma for conversion to C 5.0 compiler
+* 12-11-87 JCR Added "_LOAD_DS" to declaration
+* 03-14-90 GJF Replaced _LOAD_DS with _CALLTYPE1, added #include
+* <cruntime.h> and fixed the copyright. Also, cleaned up
+* the formatting a bit.
+* 10-04-90 GJF New-style function declarator.
+* 12-28-90 SRW Added _CRUISER_ conditional around function pragma
+* 04-01-91 SRW Enable #pragma function for i386 _WIN32_ builds too.
+* 03-09-94 RDL Enable #pragma function for MIPS _WIN32_ builds too.
+*
+*******************************************************************************/
+
+#include <cruntime.h>
+#include <stdlib.h>
+
+#ifdef _MSC_VER
+#pragma function(abs)
+#endif
+
+/***
+*int abs(number) - find absolute value of number
+*
+*Purpose:
+* Returns the absolute value of number (if number >= 0, returns number,
+* else returns -number).
+*
+*Entry:
+* int number - number to find absolute value of
+*
+*Exit:
+* returns the aboslute value of number
+*
+*Exceptions:
+*
+*******************************************************************************/
+
+int _CALLTYPE1 abs (
+ int number
+ )
+{
+ return( number>=0 ? number : -number );
+}