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.

llvm-svn: 158669
This commit is contained in:
Joerg Sonnenberger 2012-06-18 18:51:13 +00:00
parent 7b33767275
commit 8524f0ba2f
5 changed files with 5 additions and 5 deletions

View File

@ -85,7 +85,7 @@ __adddf3(fp_t a, fp_t b) {
// 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);

View File

@ -84,7 +84,7 @@ fp_t __addsf3(fp_t a, fp_t b) {
// 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);

View File

@ -124,7 +124,7 @@ static inline void wideLeftShift(rep_t *hi, rep_t *lo, int count) {
*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;

View File

@ -96,7 +96,7 @@ __muldf3(fp_t a, fp_t b) {
// 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

View File

@ -92,7 +92,7 @@ __mulsf3(fp_t a, fp_t b) {
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 {