forked from nuttx/nuttx-update
Add labs(), llabs(), and imaxabs()
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2986 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
c11c3212f0
commit
9acbc30608
5 changed files with 19 additions and 9 deletions
|
@ -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().
|
||||
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue