diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-02-28 13:42:19 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-02-28 13:42:19 +0000 |
commit | cbade4e74a17aa881e8031b6785657d7166dd819 (patch) | |
tree | 2e5a62c23ceef9959d6951854be6cb6ad3aafdef | |
parent | ecfc958f561da896a1ea1b08c2ceb4db25cc58b1 (diff) | |
download | nuttx-cbade4e74a17aa881e8031b6785657d7166dd819.tar.gz nuttx-cbade4e74a17aa881e8031b6785657d7166dd819.tar.bz2 nuttx-cbade4e74a17aa881e8031b6785657d7166dd819.zip |
Fix link problems
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@24 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r-- | nuttx/arch/c5471/Make.defs | 3 | ||||
-rw-r--r-- | nuttx/arch/c5471/src/Makefile | 3 | ||||
-rw-r--r-- | nuttx/arch/sim/Make.defs | 3 | ||||
-rw-r--r-- | nuttx/arch/sim/src/Makefile | 3 | ||||
-rw-r--r-- | nuttx/drivers/Makefile | 2 | ||||
-rw-r--r-- | nuttx/fs/Makefile | 2 | ||||
-rw-r--r-- | nuttx/lib/lib_rint.c | 86 |
7 files changed, 57 insertions, 45 deletions
diff --git a/nuttx/arch/c5471/Make.defs b/nuttx/arch/c5471/Make.defs index f75abdad6..359f4585e 100644 --- a/nuttx/arch/c5471/Make.defs +++ b/nuttx/arch/c5471/Make.defs @@ -60,9 +60,6 @@ OBJDUMP = $(CROSSDEV)objdump CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) -pipe -LDFLAGS = $(ARCHSCRIPT) -EXTRA_LIBS = - OBJEXT = .o LIBEXT = .a diff --git a/nuttx/arch/c5471/src/Makefile b/nuttx/arch/c5471/src/Makefile index e2a4dc4ba..3c1e50010 100644 --- a/nuttx/arch/c5471/src/Makefile +++ b/nuttx/arch/c5471/src/Makefile @@ -56,6 +56,9 @@ COBJS = $(CSRCS:.c=.o) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) +LDFLAGS = $(ARCHSCRIPT) +EXTRA_LIBS = + LINKOBJS = LINKLIBS = LDPATHES = $(addprefix -L$(TOPDIR)/,$(dir $(LINKLIBS))) diff --git a/nuttx/arch/sim/Make.defs b/nuttx/arch/sim/Make.defs index da5b1ba48..3e4d0cf75 100644 --- a/nuttx/arch/sim/Make.defs +++ b/nuttx/arch/sim/Make.defs @@ -59,9 +59,6 @@ OBJDUMP = $(CROSSDEV)objdump CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \ $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) -pipe -LDFLAGS = $(ARCHSCRIPT) -EXTRA_LIBS = -lc - OBJEXT = .o LIBEXT = .a diff --git a/nuttx/arch/sim/src/Makefile b/nuttx/arch/sim/src/Makefile index cb3f96b73..a3be44f35 100644 --- a/nuttx/arch/sim/src/Makefile +++ b/nuttx/arch/sim/src/Makefile @@ -51,6 +51,9 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) +LDFLAGS = $(ARCHSCRIPT) +EXTRA_LIBS = -lc + LINKOBJS = LINKLIBS = LDPATHES = $(addprefix -L$(TOPDIR)/,$(dir $(LINKLIBS))) diff --git a/nuttx/drivers/Makefile b/nuttx/drivers/Makefile index dc07fcdc7..8d687a67c 100644 --- a/nuttx/drivers/Makefile +++ b/nuttx/drivers/Makefile @@ -53,7 +53,7 @@ all: $(BIN) $(AOBJS): %$(OBJEXT): %.S $(CC) -c $(CFLAGS) -D__ASSEMBLY__ $< -o $@ -$(cOBJS): %$(OBJEXT): %.c +$(COBJS): %$(OBJEXT): %.c $(CC) -c $(CFLAGS) $< -o $@ $(BIN): $(OBJS) diff --git a/nuttx/fs/Makefile b/nuttx/fs/Makefile index 647739e32..b7d09a4e9 100644 --- a/nuttx/fs/Makefile +++ b/nuttx/fs/Makefile @@ -54,7 +54,7 @@ all: $(BIN) $(AOBJS): %$(OBJEXT): %.S $(CC) -c $(CFLAGS) -D__ASSEMBLY__ $< -o $@ -$(cOBJS): %$(OBJEXT): %.c +$(COBJS): %$(OBJEXT): %.c $(CC) -c $(CFLAGS) $< -o $@ $(BIN): $(OBJS) diff --git a/nuttx/lib/lib_rint.c b/nuttx/lib/lib_rint.c index 632c6632d..a0f7dbd4f 100644 --- a/nuttx/lib/lib_rint.c +++ b/nuttx/lib/lib_rint.c @@ -41,6 +41,7 @@ * Included Files ************************************************************/ +#include <nuttx/config.h> #include <sys/types.h> #include <stdlib.h> @@ -74,50 +75,61 @@ double_t rint(double_t x) { - double_t retValue; + double_t ret; -/* If the current rounding mode rounds toward negative - * infinity, rint() is identical to floor(). If the current - * rounding mode rounds toward positive infinity, rint() is - * identical to ceil(). */ -#if ((defined(FP_ROUND_POSITIVE)) && (FP_ROUNDING_POSITIVE != 0)) - retValue = ceil(x); + /* If the current rounding mode rounds toward negative + * infinity, rint() is identical to floor(). If the current + * rounding mode rounds toward positive infinity, rint() is + * identical to ceil(). + */ -#elif ((defined(FP_ROUND_NEGATIVE)) && (FP_ROUNDING_NEGATIVE != 0)) - retValue = floor(x); +#if defined(CONFIG_FP_ROUND_POSITIVE) && CONFIG_FP_ROUNDING_POSITIVE != 0 -#else - - /* In the default rounding mode (round to nearest), rint(x) is the - * integer nearest x with the additional stipulation that if - * |rint(x)-x|=1/2, then rint(x) is even. */ - - long dwInteger = (long)x; - double_t fRemainder = x - (double_t)dwInteger; + ret = ceil(x); - if (x < 0.0) { +#elif defined(CONFIG_FP_ROUND_NEGATIVE) && CONFIG_FP_ROUNDING_NEGATIVE != 0 - /* fRemainder should be in range 0 .. -1 */ - if (fRemainder == -0.5) - dwInteger = ((dwInteger+1)&~1); - else if (fRemainder < -0.5) { - dwInteger--; + ret = floor(x); - } /* end if */ - } /* end if */ - else { - - /* fRemainder should be in range 0 .. 1 */ - if (fRemainder == 0.5) - dwInteger = ((dwInteger+1)&~1); - else if (fRemainder > 0.5) { - dwInteger++; - - } /* end if */ - } /* end else */ +#else - retValue = (double_t)dwInteger; + /* In the default rounding mode (round to nearest), rint(x) is the + * integer nearest x with the additional stipulation that if + * |rint(x)-x|=1/2, then rint(x) is even. + */ + + long dwinteger = (long)x; + double_t fremainder = x - (double_t)dwinteger; + + if (x < 0.0) + { + /* fremainder should be in range 0 .. -1 */ + + if (fremainder == -0.5) + { + dwinteger = ((dwinteger+1)&~1); + } + else if (fremainder < -0.5) + { + dwinteger--; + } + } + else + { + /* fremainder should be in range 0 .. 1 */ + + if (fremainder == 0.5) + { + dwinteger = ((dwinteger+1)&~1); + } + else if (fremainder > 0.5) + { + dwinteger++; + } + } + + ret = (double_t)dwinteger; #endif - return retValue; + return ret; } |