Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 20 Mar 2010 21:15:56 +0000 (UTC)
From:      Marius Strobl <marius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r205394 - head/lib/libc/sparc64/fpu
Message-ID:  <201003202115.o2KLFuhH090243@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marius
Date: Sat Mar 20 21:15:56 2010
New Revision: 205394
URL: http://svn.freebsd.org/changeset/base/205394

Log:
  Ensure that __fpu_ftox() both returns the high bits and res[1] contains
  the low bits also in the default case.
  
  PR:		144900
  Obtained from:	OpenBSD
  MFC after:	3 days

Modified:
  head/lib/libc/sparc64/fpu/fpu_implode.c

Modified: head/lib/libc/sparc64/fpu/fpu_implode.c
==============================================================================
--- head/lib/libc/sparc64/fpu/fpu_implode.c	Sat Mar 20 21:04:47 2010	(r205393)
+++ head/lib/libc/sparc64/fpu/fpu_implode.c	Sat Mar 20 21:15:56 2010	(r205394)
@@ -248,8 +248,8 @@ __fpu_ftox(fe, fp, res)
 	sign = fp->fp_sign;
 	switch (fp->fp_class) {
 	case FPC_ZERO:
-		res[1] = 0;
-		return (0);
+		i = 0;
+		goto done;
 
 	case FPC_NUM:
 		/*
@@ -273,15 +273,17 @@ __fpu_ftox(fe, fp, res)
 			break;
 		if (sign)
 			i = -i;
-		res[1] = (int)i;
-		return (i >> 32);
+		goto done;
 
 	default:		/* Inf, qNaN, sNaN */
 		break;
 	}
 	/* overflow: replace any inexact exception with invalid */
 	fe->fe_cx = (fe->fe_cx & ~FSR_NX) | FSR_NV;
-	return (0x7fffffffffffffffLL + sign);
+	i = 0x7fffffffffffffffLL + sign;
+done:
+	res[1] = i & 0xffffffff;
+	return (i >> 32);
 }
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201003202115.o2KLFuhH090243>