*BSD News Article 10643


Return to BSD News archive

Received: by minnie.vk1xwt.ampr.org with NNTP
	id AA417 ; Sun, 31 Jan 93 14:07:12 EST
Path: sserve!manuel.anu.edu.au!munnari.oz.au!sgiblab!zaphod.mps.ohio-state.edu!howland.reston.ans.net!paladin.american.edu!news.univie.ac.at!hp4at!mcsun!sunic!dkuug!flshub!phk
From: phk@data.fls.dk (P-HK/Poul-Henning Kamp)
Newsgroups: comp.unix.bsd
Subject: [386bsd] PATCH: libc::ldexp()
Message-ID: <1993Feb1.133820.9016@data.fls.dk>
Date: 1 Feb 93 13:38:20 GMT
Organization: FLS Data A/S, Valby, Copenhagen, Denmark.
Lines: 88

What:
=====
Here is a patch which creates a new file:

	/usr/src/lib/libc/i386/gen/ldexp.s

containing an assembler version of ldexp() instead of inline assembler in C.

Having applied this patch you can remove the old "c" source-file:

	/usr/src/lib/libc/i386/gen/ldexp.c

No other changes need to be made.

Why:
====
gcc-2.3.3 can't compile ldexp.c. BUT, BUT, BUT, it actually improved the
quality of printf() !, two of the four errors from enquire.c disappeared.

Please Nate or <whoever_now_in_charge> add this to the patch-kit.

Happy hacking,
Poul-Henning

*** /dev/null	Sat Jan 30 23:47:35 1993
--- usr/src/lib/libc/i386/gen/ldexp.s	Sun Jan 31 12:00:01 1993
***************
*** 0 ****
--- 1,54 ----
+ /*-
+  * Copyright (c) 1990 The Regents of the University of California.
+  * All rights reserved.
+  *
+  * This code is derived from software contributed to Berkeley by
+  * William Jolitz.
+  *
+  * Redistribution and use in source and binary forms, with or without
+  * modification, are permitted provided that the following conditions
+  * are met:
+  * 1. Redistributions of source code must retain the above copyright
+  *    notice, this list of conditions and the following disclaimer.
+  * 2. Redistributions in binary form must reproduce the above copyright
+  *    notice, this list of conditions and the following disclaimer in the
+  *    documentation and/or other materials provided with the distribution.
+  * 3. All advertising materials mentioning features or use of this software
+  *    must display the following acknowledgement:
+  *	This product includes software developed by the University of
+  *	California, Berkeley and its contributors.
+  * 4. Neither the name of the University nor the names of its contributors
+  *    may be used to endorse or promote products derived from this software
+  *    without specific prior written permission.
+  *
+  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+  * SUCH DAMAGE.
+  */
+ 
+ /*
+  * Assebler version by phk@data.fls.dk Poul-Henning Kamp
+  * works with gcc2 (since it's not compiled by it :-)
+  * enquire.c even seems to work better ????
+  */
+ #if defined(LIBC_SCCS) && !defined(lint)
+ 	.asciz "@(#)ldexp.s	5.2 (Berkeley) 12/17/90"
+ #endif /* LIBC_SCCS and not lint */
+ 
+ #include "DEFS.h"
+ 
+ ENTRY(ldexp)
+ 	fildl 12(%esp)
+ 	fldl 4(%esp)
+ 	fscale
+ 	fxch %st(1)
+ 	fstpl -8(%esp)	/* How do I pop a value ??? */
+ 	ret
-- 
phk@data.fls.dk		  ||  The seven hazards of computing:
Poul-Henning Kamp	  ||  The hardware, the software, the supplier
FLS DATA A/S, Denmark	  ||  the application, the user, the operator
Phone: (+45) 36 18 12 35  ||  and the data.		Stan Kelly-Bootle