Commit d51b0053 by H.J. Lu Committed by H.J. Lu

cppexp.c (num_trim): Use 1UL instead of 1 for long int.

2002-05-27  H.J. Lu  (hjl@gnu.org)

	* cppexp.c (num_trim): Use 1UL instead of 1 for long int.
	(num_positive): Likewise.
	(num_div_op): Likewise.

From-SVN: r53939
parent 2530d6aa
2002-05-27 H.J. Lu (hjl@gnu.org)
* cppexp.c (num_trim): Use 1UL instead of 1 for long int.
(num_positive): Likewise.
(num_div_op): Likewise.
2002-05-27 Neil Booth <neil@daikokuya.demon.co.uk> 2002-05-27 Neil Booth <neil@daikokuya.demon.co.uk>
* c-common.c (c_common_init): Always use intmax_t. * c-common.c (c_common_init): Always use intmax_t.
......
...@@ -787,12 +787,12 @@ num_trim (num, precision) ...@@ -787,12 +787,12 @@ num_trim (num, precision)
{ {
precision -= PART_PRECISION; precision -= PART_PRECISION;
if (precision < PART_PRECISION) if (precision < PART_PRECISION)
num.high &= (1 << precision) - 1; num.high &= (1UL << precision) - 1;
} }
else else
{ {
if (precision < PART_PRECISION) if (precision < PART_PRECISION)
num.low &= (1 << precision) - 1; num.low &= (1UL << precision) - 1;
num.high = 0; num.high = 0;
} }
...@@ -808,10 +808,10 @@ num_positive (num, precision) ...@@ -808,10 +808,10 @@ num_positive (num, precision)
if (precision > PART_PRECISION) if (precision > PART_PRECISION)
{ {
precision -= PART_PRECISION; precision -= PART_PRECISION;
return (num.high & (1 << (precision - 1))) == 0; return (num.high & (1UL << (precision - 1))) == 0;
} }
return (num.low & (1 << (precision - 1))) == 0; return (num.low & (1UL << (precision - 1))) == 0;
} }
/* Returns the negative of NUM. */ /* Returns the negative of NUM. */
...@@ -1245,7 +1245,7 @@ num_div_op (pfile, lhs, rhs, op) ...@@ -1245,7 +1245,7 @@ num_div_op (pfile, lhs, rhs, op)
if (rhs.high) if (rhs.high)
{ {
i = precision - 1; i = precision - 1;
mask = 1 << (i - PART_PRECISION); mask = 1UL << (i - PART_PRECISION);
for (; ; i--, mask >>= 1) for (; ; i--, mask >>= 1)
if (rhs.high & mask) if (rhs.high & mask)
break; break;
...@@ -1256,7 +1256,7 @@ num_div_op (pfile, lhs, rhs, op) ...@@ -1256,7 +1256,7 @@ num_div_op (pfile, lhs, rhs, op)
i = precision - PART_PRECISION - 1; i = precision - PART_PRECISION - 1;
else else
i = precision - 1; i = precision - 1;
mask = 1 << i; mask = 1UL << i;
for (; ; i--, mask >>= 1) for (; ; i--, mask >>= 1)
if (rhs.low & mask) if (rhs.low & mask)
break; break;
...@@ -1284,9 +1284,9 @@ num_div_op (pfile, lhs, rhs, op) ...@@ -1284,9 +1284,9 @@ num_div_op (pfile, lhs, rhs, op)
{ {
lhs = num_binary_op (pfile, lhs, sub, CPP_MINUS); lhs = num_binary_op (pfile, lhs, sub, CPP_MINUS);
if (i >= PART_PRECISION) if (i >= PART_PRECISION)
result.high |= 1 << (i - PART_PRECISION); result.high |= 1UL << (i - PART_PRECISION);
else else
result.low |= 1 << i; result.low |= 1UL << i;
} }
if (i-- == 0) if (i-- == 0)
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment