| 655 | } |
| 656 | |
| 657 | static int_fast32_2s |
| 658 | detzcode(const char *const codep) |
| 659 | { |
| 660 | register int i; |
| 661 | int_fast32_2s |
| 662 | maxval = TWO_31_MINUS_1, |
| 663 | minval = -1 - maxval, |
| 664 | result; |
| 665 | |
| 666 | result = codep[0] & 0x7f; |
| 667 | for (i = 1; i < 4; ++i) |
| 668 | result = (result << 8) | (codep[i] & 0xff); |
| 669 | |
| 670 | if (codep[0] & 0x80) { |
| 671 | /* Do two's-complement negation even on non-two's-complement machines. |
| 672 | This cannot overflow, as int_fast32_2s is wide enough. */ |
| 673 | result += minval; |
| 674 | } |
| 675 | return result; |
| 676 | } |
| 677 | |
| 678 | static int_fast64_t |
| 679 | detzcode64(const char *const codep) |