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