Subject: libc arch/*/gen cleanup
To: None <tech-userlevel@netbsd.org>
From: Simon Burge <simonb@wasabisystems.com>
List: tech-userlevel
Date: 10/27/2001 16:09:22
So I noticed that there's a _lot_ of code duplication in some of the
MD parts of libc.  I'd like to get rid of multiple copies of a lot of
these files.  The following files are essentially same on a lot of/most
architectures:

	frexp.c
	isinf.c
	isnan.c
	ldexp.c
	modf.c

Also, infinity.c and nanf.c are mostly the same too - there's some
differences in alignment constraints for some architectures.  To make
MI versions if these, I'm proposing an infinity.c that looks like

	#include <math.h>
	#include <machine/endian.h>

	const char __infinity[] __attribute__((__aligned__(__alignof__(double)))) =
	#if BYTE_ORDER == BIG_ENDIAN
		{ 0x7f, (char)0xf0, 0, 0, 0, 0, 0, 0 };
	#else
		{ 0, 0, 0, 0, 0, 0, (char)0xf0, 0x7f };
	#endif

and a nanf that looks like

	#include <math.h>
	#include <machine/endian.h>

	/* bytes for quiet NaN (IEEE single precision) */
	const char __nanf[] __attribute__((__aligned__(__alignof__(single)))) =
	#if BYTE_ORDER == BIG_ENDIAN
		{ 0x7f, (char)0xc0, 0, 0 };
	#else
		{ 0, 0, (char)0xc0, 0x7f };
	#endif

To stop any hassles with finding the correct version, was thinking of
adding version in libc/gen all with "gen_" prefixes.

Anyone see any problems with this?

Simon.
--
Simon Burge                            <simonb@wasabisystems.com>
NetBSD CDs, Support and Service:    http://www.wasabisystems.com/