expr.c (256281) | expr.c (259890) |
---|---|
1/* Parse C expressions for cpplib. 2 Copyright (C) 1987, 1992, 1994, 1995, 1997, 1998, 1999, 2000, 2001, 3 2002, 2004 Free Software Foundation. 4 Contributed by Per Bothner, 1994. 5 6This program is free software; you can redistribute it and/or modify it 7under the terms of the GNU General Public License as published by the 8Free Software Foundation; either version 2, or (at your option) any --- 73 unchanged lines hidden (view full) --- 82static unsigned int 83interpret_float_suffix (const uchar *s, size_t len) 84{ 85 size_t f = 0, l = 0, i = 0, d = 0, d0 = 0; 86 87 while (len--) 88 switch (s[len]) 89 { | 1/* Parse C expressions for cpplib. 2 Copyright (C) 1987, 1992, 1994, 1995, 1997, 1998, 1999, 2000, 2001, 3 2002, 2004 Free Software Foundation. 4 Contributed by Per Bothner, 1994. 5 6This program is free software; you can redistribute it and/or modify it 7under the terms of the GNU General Public License as published by the 8Free Software Foundation; either version 2, or (at your option) any --- 73 unchanged lines hidden (view full) --- 82static unsigned int 83interpret_float_suffix (const uchar *s, size_t len) 84{ 85 size_t f = 0, l = 0, i = 0, d = 0, d0 = 0; 86 87 while (len--) 88 switch (s[len]) 89 { |
90 case 'f': case 'F': f++; break; 91 case 'l': case 'L': l++; break; 92 case 'i': case 'I': 93 case 'j': case 'J': i++; break; 94 case 'd': case 'D': 95 /* Disallow fd, ld suffixes. */ 96 if (d && (f || l)) | 90 case 'f': case 'F': 91 if (d > 0) |
97 return 0; | 92 return 0; |
98 d++; | 93 f++; |
99 break; | 94 break; |
95 case 'l': case 'L': 96 if (d > 0) 97 return 0; 98 l++; 99 break; 100 case 'i': case 'I': 101 case 'j': case 'J': i++; break; 102 case 'd': case 'D': d++; break; |
|
100 default: 101 return 0; 102 } 103 104 if (d == 1 && !f && !l) { 105 d = 0; 106 d0 = 1; 107 } --- 381 unchanged lines hidden (view full) --- 489 add_high = (num.high << 1) + (num.low >> (PART_PRECISION - 1)); 490 } 491 else 492 add_high = add_low = 0; 493 494 if (add_low + digit < add_low) 495 add_high++; 496 add_low += digit; | 103 default: 104 return 0; 105 } 106 107 if (d == 1 && !f && !l) { 108 d = 0; 109 d0 = 1; 110 } --- 381 unchanged lines hidden (view full) --- 492 add_high = (num.high << 1) + (num.low >> (PART_PRECISION - 1)); 493 } 494 else 495 add_high = add_low = 0; 496 497 if (add_low + digit < add_low) 498 add_high++; 499 add_low += digit; |
497 | 500 |
498 if (result.low + add_low < result.low) 499 add_high++; 500 if (result.high + add_high < result.high) 501 overflow = true; 502 503 result.low += add_low; 504 result.high += add_high; 505 result.overflow = overflow; --- 1069 unchanged lines hidden (view full) --- 1575 if (op == CPP_DIV) 1576 { 1577 result.unsignedp = unsignedp; 1578 result.overflow = false; 1579 if (!unsignedp) 1580 { 1581 if (negate) 1582 result = num_negate (result, precision); | 501 if (result.low + add_low < result.low) 502 add_high++; 503 if (result.high + add_high < result.high) 504 overflow = true; 505 506 result.low += add_low; 507 result.high += add_high; 508 result.overflow = overflow; --- 1069 unchanged lines hidden (view full) --- 1578 if (op == CPP_DIV) 1579 { 1580 result.unsignedp = unsignedp; 1581 result.overflow = false; 1582 if (!unsignedp) 1583 { 1584 if (negate) 1585 result = num_negate (result, precision); |
1583 result.overflow = num_positive (result, precision) ^ !negate; | 1586 result.overflow = (num_positive (result, precision) ^ !negate 1587 && !num_zerop (result)); |
1584 } 1585 1586 return result; 1587 } 1588 1589 /* CPP_MOD. */ 1590 lhs.unsignedp = unsignedp; 1591 lhs.overflow = false; 1592 if (lhs_neg) 1593 lhs = num_negate (lhs, precision); 1594 1595 return lhs; 1596} | 1588 } 1589 1590 return result; 1591 } 1592 1593 /* CPP_MOD. */ 1594 lhs.unsignedp = unsignedp; 1595 lhs.overflow = false; 1596 if (lhs_neg) 1597 lhs = num_negate (lhs, precision); 1598 1599 return lhs; 1600} |