[llvm-commits] [compiler-rt] r158669 - in /compiler-rt/trunk/lib: adddf3.c addsf3.c fp_lib.h muldf3.c mulsf3.c
Joerg Sonnenberger
joerg at bec.de
Mon Jun 18 11:51:14 PDT 2012
Author: joerg
Date: Mon Jun 18 13:51:13 2012
New Revision: 158669
URL: http://llvm.org/viewvc/llvm-project?rev=158669&view=rev
Log:
Declare some variables unsigned to avoid signed vs unsigned mismatches.
This exploits the relative order of the arguments and/or checks already
made in the functions.
Modified:
compiler-rt/trunk/lib/adddf3.c
compiler-rt/trunk/lib/addsf3.c
compiler-rt/trunk/lib/fp_lib.h
compiler-rt/trunk/lib/muldf3.c
compiler-rt/trunk/lib/mulsf3.c
Modified: compiler-rt/trunk/lib/adddf3.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/adddf3.c?rev=158669&r1=158668&r2=158669&view=diff
==============================================================================
--- compiler-rt/trunk/lib/adddf3.c (original)
+++ compiler-rt/trunk/lib/adddf3.c Mon Jun 18 13:51:13 2012
@@ -85,7 +85,7 @@
// Shift the significand of b by the difference in exponents, with a sticky
// bottom bit to get rounding correct.
- const int align = aExponent - bExponent;
+ const unsigned int align = aExponent - bExponent;
if (align) {
if (align < typeWidth) {
const bool sticky = bSignificand << (typeWidth - align);
Modified: compiler-rt/trunk/lib/addsf3.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/addsf3.c?rev=158669&r1=158668&r2=158669&view=diff
==============================================================================
--- compiler-rt/trunk/lib/addsf3.c (original)
+++ compiler-rt/trunk/lib/addsf3.c Mon Jun 18 13:51:13 2012
@@ -84,7 +84,7 @@
// Shift the significand of b by the difference in exponents, with a sticky
// bottom bit to get rounding correct.
- const int align = aExponent - bExponent;
+ const unsigned int align = aExponent - bExponent;
if (align) {
if (align < typeWidth) {
const bool sticky = bSignificand << (typeWidth - align);
Modified: compiler-rt/trunk/lib/fp_lib.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fp_lib.h?rev=158669&r1=158668&r2=158669&view=diff
==============================================================================
--- compiler-rt/trunk/lib/fp_lib.h (original)
+++ compiler-rt/trunk/lib/fp_lib.h Mon Jun 18 13:51:13 2012
@@ -124,7 +124,7 @@
*lo = *lo << count;
}
-static inline void wideRightShiftWithSticky(rep_t *hi, rep_t *lo, int count) {
+static inline void wideRightShiftWithSticky(rep_t *hi, rep_t *lo, unsigned int count) {
if (count < typeWidth) {
const bool sticky = *lo << (typeWidth - count);
*lo = *hi << (typeWidth - count) | *lo >> count | sticky;
Modified: compiler-rt/trunk/lib/muldf3.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/muldf3.c?rev=158669&r1=158668&r2=158669&view=diff
==============================================================================
--- compiler-rt/trunk/lib/muldf3.c (original)
+++ compiler-rt/trunk/lib/muldf3.c Mon Jun 18 13:51:13 2012
@@ -96,7 +96,7 @@
// a zero of the appropriate sign. Mathematically there is no need to
// handle this case separately, but we make it a special case to
// simplify the shift logic.
- const int shift = 1 - productExponent;
+ const unsigned int shift = 1U - (unsigned int)productExponent;
if (shift >= typeWidth) return fromRep(productSign);
// Otherwise, shift the significand of the result so that the round
Modified: compiler-rt/trunk/lib/mulsf3.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/mulsf3.c?rev=158669&r1=158668&r2=158669&view=diff
==============================================================================
--- compiler-rt/trunk/lib/mulsf3.c (original)
+++ compiler-rt/trunk/lib/mulsf3.c Mon Jun 18 13:51:13 2012
@@ -92,7 +92,7 @@
if (productExponent <= 0) {
// Result is denormal before rounding, the exponent is zero and we
// need to shift the significand.
- wideRightShiftWithSticky(&productHi, &productLo, 1 - productExponent);
+ wideRightShiftWithSticky(&productHi, &productLo, 1U - (unsigned)productExponent);
}
else {
More information about the llvm-commits
mailing list