| 908 | } |
| 909 | |
| 910 | int64 BfIRCodeGen::ReadSLEB128() |
| 911 | { |
| 912 | int64 val = 0; |
| 913 | int64 shift = 0; |
| 914 | uint8 byteVal; |
| 915 | do |
| 916 | { |
| 917 | byteVal = mStream->Read(); |
| 918 | val |= ((int64)(byteVal & 0x7f)) << shift; |
| 919 | shift += 7; |
| 920 | } while (byteVal >= 128); |
| 921 | // Sign extend negative numbers. |
| 922 | if ((byteVal & 0x40) && (shift < 64)) |
| 923 | val |= (-1ULL) << shift; |
| 924 | return val; |
| 925 | } |
| 926 | |
| 927 | void BfIRCodeGen::Read(StringImpl& str) |
| 928 | { |