9
0
Fork 0

Add labs(), llabs(), and imaxabs()

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@2986 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo 2010-10-09 21:12:49 +00:00
parent 52a54886a4
commit 2738ef4503
5 changed files with 19 additions and 9 deletions

View File

@ -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().

View File

@ -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>

View File

@ -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 */

View File

@ -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

View File

@ -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;
}