unwind-pe.h (read_uleb128): Fix handling of large values

* unwind-pe.h (read_uleb128): Fix handling of large values
	(read_sleb128): Fix handling of large values

From-SVN: r74429
This commit is contained in:
Jan Hubicka 2003-12-08 20:47:12 +01:00 committed by Jan Hubicka
parent 32b32b1606
commit f167b1c037
2 changed files with 8 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2003-12-08 Jan Hubicka <jh@suse.cz>
* unwind-pe.h (read_uleb128): Fix handling of large values
(read_sleb128): Fix handling of large values
2003-12-08 Andrew Pinski <pinskia@physics.uc.edu>
PR middle-end/10060

View File

@ -137,7 +137,7 @@ read_uleb128 (const unsigned char *p, _Unwind_Word *val)
do
{
byte = *p++;
result |= (byte & 0x7f) << shift;
result |= ((_Unwind_Word)byte & 0x7f) << shift;
shift += 7;
}
while (byte & 0x80);
@ -159,14 +159,14 @@ read_sleb128 (const unsigned char *p, _Unwind_Sword *val)
do
{
byte = *p++;
result |= (byte & 0x7f) << shift;
result |= ((_Unwind_Word)byte & 0x7f) << shift;
shift += 7;
}
while (byte & 0x80);
/* Sign-extend a negative value. */
if (shift < 8 * sizeof(result) && (byte & 0x40) != 0)
result |= -(1L << shift);
result |= -(((_Unwind_Word)1L) << shift);
*val = (_Unwind_Sword) result;
return p;