[PATCH] Prepare for the VAX architecture

Jan-Benedict Glaw jbglaw at lug-owl.de
Wed Jan 25 21:56:01 UTC 2006


Hi!

The arch-specific patches are quite separate and won't probably
interfer with the rest of uClibc. However, there's this patch that
touches common code I'd like you to approve. It fixes an IEEE
assumption in non-libm code.

diff -Nurp src-uclibc-fresh/extra/Configs/Config.in src-uclibc-hacked/extra/Configs/Config.in
--- src-uclibc-fresh/extra/Configs/Config.in	2006-01-22 16:49:40.000000000 +0100
+++ src-uclibc-hacked/extra/Configs/Config.in	2006-01-25 22:45:09.000000000 +0100
@@ -71,6 +71,9 @@ config TARGET_sparc
 config TARGET_v850
 	bool "v850 (BROKEN)"
 
+config TARGET_vax
+	bool "vax"
+
 config TARGET_x86_64
 	bool "x86_64"
 
diff -Nurp src-uclibc-fresh/extra/Configs/Config.in.arch src-uclibc-hacked/extra/Configs/Config.in.arch
--- src-uclibc-fresh/extra/Configs/Config.in.arch	2006-01-22 16:49:39.000000000 +0100
+++ src-uclibc-hacked/extra/Configs/Config.in.arch	2006-01-25 22:45:09.000000000 +0100
@@ -29,8 +29,8 @@ config ARCH_HAS_MMU
 	default y
 	depends !ARCH_HAS_NO_MMU
 	help
-	  If your target CPU does not have a memory management unit (MMU), 
-	  then answer N here.  Normally, Linux runs on systems with an MMU.  
+	  If your target CPU does not have a memory management unit (MMU),
+	  then answer N here.  Normally, Linux runs on systems with an MMU.
 	  If you are building a uClinux system, answer N.
 
 	  Most people will answer Y.
@@ -41,13 +41,27 @@ config UCLIBC_HAS_FLOATS
 	help
 	  This option allows you to entirely omit all floating point number
 	  support from uClibc.  This will cause floating point functions like
-	  strtod() to be omitted from uClibc.  Other floating point functions, 
-	  such as printf() and scanf() will still be included in the library, 
+	  strtod() to be omitted from uClibc.  Other floating point functions,
+	  such as printf() and scanf() will still be included in the library,
 	  but will not contain support for floating point numbers.
 
 	  Answering N to this option can reduce the size of uClibc.  Most people
 	  will answer Y.
 
+config TARGET_HAS_SIGNED_ZERO_FLOATS
+	bool "    Target CPU differs between +0.0 and -0.0"
+	default y if !TARGET_vax
+	default n if TARGET_vax
+	depends on UCLIBC_HAS_FLOATS
+	help
+	  If your target CPU can differ +0.0 and -0.0 (IEEE floating point
+	  support works that way), then you should enable this option.
+
+	  Most people will answer Y, because nearly all CPUs do use IEEE
+	  floating point support. VAX CPUs are the rare exception, because
+	  they're older than the IEEE standards for floating point
+	  representation.
+
 config UCLIBC_HAS_FPU
 	bool "Target CPU has a floating point unit (FPU)"
 	depends on UCLIBC_HAS_FLOATS
@@ -78,7 +92,7 @@ config DO_C99_MATH
 	  listed as part of the traditional POSIX/IEEE 1003.1b-1993 standard.
 	  Leaving this option set to N will save around 35k on an x86 system.
 
-	  If your applications require the newer C99 math library functions, 
+	  If your applications require the newer C99 math library functions,
 	  then answer Y.
 
 config KERNEL_SOURCE
diff -Nurp src-uclibc-fresh/libc/stdio/_fpmaxtostr.c src-uclibc-hacked/libc/stdio/_fpmaxtostr.c
--- src-uclibc-fresh/libc/stdio/_fpmaxtostr.c	2006-01-22 16:49:49.000000000 +0100
+++ src-uclibc-hacked/libc/stdio/_fpmaxtostr.c	2006-01-25 22:45:09.000000000 +0100
@@ -22,7 +22,7 @@ typedef size_t (__fp_outfunc_t)(FILE *fp
 
 /* Copyright (C) 2000, 2001, 2003      Manuel Novoa III
  *
- * Function: 
+ * Function:
  *
  *     ssize_t _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info *info,
  *                         __fp_outfunc_t fp_outfunc);
@@ -188,7 +188,7 @@ static const __fpmax_t exp16_table[] = {
 #if FPMAX_MAX_EXP >= 16384
 	0x1.0p16384L
 #endif
-#if FPMAX_MAX_EXP >= 32768 
+#if FPMAX_MAX_EXP >= 32768
 #error unsupported FPMAX_MAX_EXP.  please increase table
 #endif
 };
@@ -280,11 +280,11 @@ ssize_t attribute_hidden _fpmaxtostr(FIL
 	}
 
 	if (x == 0) {				/* Handle 0 now to avoid false positive. */
-#if 1
+#ifdef __TARGET_HAS_SIGNED_ZERO_FLOATS__
 		if (zeroisnegative(x)) { /* Handle 'signed' zero. */
 			*sign_str = '-';
 		}
-#endif
+#endif /* __TARGET_HAS_SIGNED_ZERO_FLOATS__ */
 		exp = -1;
 		goto GENERATE_DIGITS;
 	}
@@ -328,14 +328,14 @@ ssize_t attribute_hidden _fpmaxtostr(FIL
 			base = 16;
 		} else {
 			lower_bnd = 1e8;
-			/* 		upper_bnd = 1e9; */
+			/*		upper_bnd = 1e9; */
 			power_table = exp10_table;
 			exp = DIGITS_PER_BLOCK - 1;
 			i = EXP10_TABLE_SIZE;
 			j = EXP10_TABLE_MAX;
-			/* 		dpb = DIGITS_PER_BLOCK; */
-			/* 		ndb = NUM_DIGIT_BLOCKS; */
-			/* 		base = 10; */
+			/*		dpb = DIGITS_PER_BLOCK; */
+			/*		ndb = NUM_DIGIT_BLOCKS; */
+			/*		base = 10; */
 		}
 
 
@@ -394,7 +394,7 @@ ssize_t attribute_hidden _fpmaxtostr(FIL
 			uint_fast32_t digit_block = (uint_fast32_t) x;
 			assert(digit_block < upper_bnd);
 #ifdef __UCLIBC_MJN3_ONLY__
-#warning CONSIDER: Can rounding be a problem?
+#warning "CONSIDER: Can rounding be a problem?"
 #endif /* __UCLIBC_MJN3_ONLY__ */
 			x = (x - digit_block) * upper_bnd;
 			s += dpb;
@@ -411,7 +411,7 @@ ssize_t attribute_hidden _fpmaxtostr(FIL
 	if (mode < 'a') {
 		*exp_buf -= ('a' - 'A'); /* e->E and p->P */
 		mode += ('a' - 'A');
-	} 
+	}
 
 	o_mode = mode;
 	if ((mode == 'g') && (preci > 0)){
@@ -451,7 +451,7 @@ ssize_t attribute_hidden _fpmaxtostr(FIL
 #ifdef __UCLIBC_HAS_HEXADECIMAL_FLOATS__
 	if ((mode|0x20) == 'a') {
 		char *q;
-			
+
 		for (q = e ; *q ; --q) {
 			if (*q > '9') {
 				*q += (*exp_buf - ('p' - 'a') - '9' - 1);
@@ -699,12 +699,12 @@ ssize_t attribute_hidden _fpmaxtostr(FIL
 
 			cnt += num_groups * tslen; /* Adjust count now for sep chars. */
 
-/* 			__printf("\n"); */
+/*			__printf("\n"); */
 			do {
 				if (!blk) {		/* Initial group could be 0 digits long! */
 					blk = nblk2;
 				} else if (len >= blk) { /* Enough digits for a group. */
-/* 					__printf("norm:  len=%d blk=%d  \"%.*s\"\n", len, blk, blk, gp); */
+/*					__printf("norm:  len=%d blk=%d  \"%.*s\"\n", len, blk, blk, gp); */
 					if (fp_outfunc(fp, *ppc, blk, (intptr_t) gp) != blk) {
 						return -1;
 					}
@@ -714,9 +714,9 @@ ssize_t attribute_hidden _fpmaxtostr(FIL
 					}
 					len -= blk;
 				} else {		/* Transition to 0s. */
-/* 					__printf("trans: len=%d blk=%d  \"%.*s\"\n", len, blk, len, gp); */
+/*					__printf("trans: len=%d blk=%d  \"%.*s\"\n", len, blk, len, gp); */
 					if (len) {
-/* 						__printf("len\n"); */
+/*						__printf("len\n"); */
 						if (fp_outfunc(fp, *ppc, len, (intptr_t) gp) != len) {
 							return -1;
 						}
@@ -724,7 +724,7 @@ ssize_t attribute_hidden _fpmaxtostr(FIL
 					}
 
 					if (ppc[3] == FPO_ZERO_PAD) { /* Need to group 0s */
-/* 						__printf("zeropad\n"); */
+/*						__printf("zeropad\n"); */
 						cnt += ppc[1];
 						ppc += 3;
 						gp = (const char *) ppc[2];
@@ -747,7 +747,7 @@ ssize_t attribute_hidden _fpmaxtostr(FIL
 				}
 				blk = nblk2;
 
-/* 				__printf("num_groups=%d   blk=%d\n", num_groups, blk); */
+/*				__printf("num_groups=%d   blk=%d\n", num_groups, blk); */
 
 			} while (1);
 		} else
Thanks, JBG

-- 
Jan-Benedict Glaw       jbglaw at lug-owl.de    . +49-172-7608481             _ O _
"Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg  _ _ O
 für einen Freien Staat voll Freier Bürger"  | im Internet! |   im Irak!   O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.busybox.net/pipermail/uclibc/attachments/20060125/0cc5664e/attachment-0002.pgp 


More information about the uClibc mailing list