summaryrefslogtreecommitdiff
path: root/nuttx
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx')
-rw-r--r--nuttx/ChangeLog4
-rw-r--r--nuttx/Documentation/NuttX.html5
-rw-r--r--nuttx/include/stdlib.h9
-rw-r--r--nuttx/lib/Makefile2
-rw-r--r--nuttx/lib/lib_abs.c8
5 files changed, 19 insertions, 9 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog
index 8d8d37a1c..6fb13b04a 100644
--- a/nuttx/ChangeLog
+++ b/nuttx/ChangeLog
@@ -1297,6 +1297,8 @@
for the AT91 UC3A/B family of AVR32 MCUs.
* confgs/avr32dev1 - Add support for the Atmel AVR32DEV1 board featuring
the AT91UC3B0256 MCU. This board is produced by www.mcuzone.com.
- * include/stdlib.h, lib/Makefile and lib/lib_abs.c - Add abs().
+ * include/stdlib.h, lib/Makefile, lib/lib_abs.c, lib/lib_labs.c,
+ lib_labs.c, lib_llabs.c, lib_imaxabs.c - Add abs(), labs(), llabs(), and
+ imaxabs().
diff --git a/nuttx/Documentation/NuttX.html b/nuttx/Documentation/NuttX.html
index 9f1fd03aa..99d372ebb 100644
--- a/nuttx/Documentation/NuttX.html
+++ b/nuttx/Documentation/NuttX.html
@@ -1914,8 +1914,9 @@ nuttx-5.12 2010-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
for the AT91 UC3A/B family of AVR32 MCUs.
* confgs/avr32dev1 - Add support for the Atmel AVR32DEV1 board featuring
the AT91UC3B0256 MCU. This board is produced by www.mcuzone.com.
- * include/stdlib.h, lib/Makefile and lib/lib_abs.c - Add abs().
-
+ * include/stdlib.h, lib/Makefile, lib/lib_abs.c, lib/lib_labs.c,
+ lib_labs.c, lib_llabs.c, lib_imaxabs.c - Add abs(), labs(), llabs(), and
+ imaxabs().
pascal-2.1 2010-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
diff --git a/nuttx/include/stdlib.h b/nuttx/include/stdlib.h
index c30d07ee3..7509768a1 100644
--- a/nuttx/include/stdlib.h
+++ b/nuttx/include/stdlib.h
@@ -41,7 +41,9 @@
****************************************************************************/
#include <nuttx/config.h>
+#include <nuttx/compiler.h>
#include <sys/types.h>
+#include <stdint.h>
/****************************************************************************
* Definitions
@@ -146,7 +148,12 @@ EXTERN FAR void *calloc(size_t, size_t);
/* Misc */
-EXTERN int abs(int i);
+EXTERN int abs(int j);
+EXTERN long int labs(long int j);
+#ifdef CONFIG_HAVE_LONG_LONG
+EXTERN long long int llabs(long long int j);
+#endif
+EXTERN intmax_t imaxabs(intmax_t j);
/* Sorting */
diff --git a/nuttx/lib/Makefile b/nuttx/lib/Makefile
index b8897d842..a08e72156 100644
--- a/nuttx/lib/Makefile
+++ b/nuttx/lib/Makefile
@@ -75,7 +75,7 @@ ifeq ($(CONFIG_LIBC_FLOATINGPOINT),y)
STDIO_SRCS += lib_dtoa.c
endif
-STDLIB_SRCS = lib_abs.c lib_rand.c lib_qsort.c
+STDLIB_SRCS = lib_abs.c lib_imaxabs.c lib_labs.c lib_llabs.c lib_rand.c lib_qsort.c
MATH_SRCS = lib_rint.c lib_fixedmath.c lib_b16sin.c lib_b16cos.c
diff --git a/nuttx/lib/lib_abs.c b/nuttx/lib/lib_abs.c
index 8ef131b87..39339b86c 100644
--- a/nuttx/lib/lib_abs.c
+++ b/nuttx/lib/lib_abs.c
@@ -44,11 +44,11 @@
* Global Functions
************************************************************************/
-int abs(int i)
+int abs(int j)
{
- if (i < 0)
+ if (j < 0)
{
- i = -i;
+ j = -j;
}
- return i;
+ return j;
}