1 // Copyright 2017 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 5 #ifndef _BSDIFF_CONTROL_ENTRY_H_ 6 #define _BSDIFF_CONTROL_ENTRY_H_ 7 8 #include <stdint.h> 9 10 struct ControlEntry { ControlEntryControlEntry11 constexpr ControlEntry(uint64_t diff_size, 12 uint64_t extra_size, 13 int64_t offset_increment) 14 : diff_size(diff_size), 15 extra_size(extra_size), 16 offset_increment(offset_increment) {} 17 constexpr ControlEntry() = default; 18 19 // The number of bytes to copy from the source and diff stream. 20 uint64_t diff_size{0}; 21 22 // The number of bytes to copy from the extra stream. 23 uint64_t extra_size{0}; 24 25 // The value to add to the source pointer after patching from the diff stream. 26 int64_t offset_increment{0}; 27 28 [[nodiscard]] bool operator==(const ControlEntry& o) const { 29 return diff_size == o.diff_size && extra_size == o.extra_size && 30 offset_increment == o.offset_increment; 31 } 32 }; 33 34 #endif // _BSDIFF_CONTROL_ENTRY_H_ 35