Tianjie Xu | 6528812 | 2017-10-13 15:10:58 -0700 | [diff] [blame] | 1 | #include "bsdiff/utils.h" |
2 | |||||
3 | namespace bsdiff { | ||||
4 | |||||
Tianjie Xu | 6528812 | 2017-10-13 15:10:58 -0700 | [diff] [blame] | 5 | int64_t ParseInt64(const uint8_t* buf) { |
6 | int64_t result = buf[7] & 0x7F; | ||||
7 | for (int i = 6; i >= 0; i--) { | ||||
8 | result <<= 8; | ||||
9 | result |= buf[i]; | ||||
10 | } | ||||
11 | |||||
12 | if (buf[7] & 0x80) | ||||
13 | result = -result; | ||||
14 | return result; | ||||
15 | } | ||||
16 | |||||
Tianjie Xu | 1f1cdb2 | 2017-11-20 11:05:55 -0800 | [diff] [blame^] | 17 | } // namespace bsdiff |