blob: c3e613e3c5ee00ba392c818504d5a36e83fa1723 [file] [log] [blame]
Alex Deymo4fd22ea2018-02-15 16:13:28 +01001// Copyright 2018 The Chromium OS Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
Tianjie Xu65288122017-10-13 15:10:58 -07005#include "bsdiff/utils.h"
6
7namespace bsdiff {
8
Tianjie Xu65288122017-10-13 15:10:58 -07009int64_t ParseInt64(const uint8_t* buf) {
10 int64_t result = buf[7] & 0x7F;
11 for (int i = 6; i >= 0; i--) {
12 result <<= 8;
13 result |= buf[i];
14 }
15
16 if (buf[7] & 0x80)
17 result = -result;
18 return result;
19}
20
Tianjie Xu1f1cdb22017-11-20 11:05:55 -080021} // namespace bsdiff