From 0fc3c6c696337318d787f1b19b649f175692f0fc Mon Sep 17 00:00:00 2001 From: Otto Moerbeek Date: Tue, 6 May 2025 10:20:35 +0200 Subject: [PATCH] Upgrade to protozero 1.8.0: https://github.com/mapbox/protozero/releases/tag/v1.8.0 --- ext/protozero/CHANGELOG.md | 21 ++++++- ext/protozero/LICENSE.md | 16 +++--- .../include/protozero/basic_pbf_builder.hpp | 4 +- .../include/protozero/basic_pbf_writer.hpp | 56 +++++++++---------- .../include/protozero/buffer_string.hpp | 4 +- ext/protozero/include/protozero/data_view.hpp | 4 +- .../include/protozero/pbf_message.hpp | 2 +- .../include/protozero/pbf_reader.hpp | 8 +-- ext/protozero/include/protozero/types.hpp | 2 +- ext/protozero/include/protozero/varint.hpp | 47 ++++++++-------- ext/protozero/include/protozero/version.hpp | 6 +- 11 files changed, 95 insertions(+), 75 deletions(-) diff --git a/ext/protozero/CHANGELOG.md b/ext/protozero/CHANGELOG.md index 35a793c101..8b28db15af 100644 --- a/ext/protozero/CHANGELOG.md +++ b/ext/protozero/CHANGELOG.md @@ -14,6 +14,24 @@ This project adheres to [Semantic Versioning](https://semver.org/). ### Fixed +## [1.8.0] - 2024-01-13 + +### Changed + +- Switched to C++14 as minimum requirement. Modernised the code accordingly. +- Only the tests need the Protobuf library when building. +- Improve compatibility with various STL flavors. +- Change license formatting to get recognized by license scanning tools. +- Add lots of `const` in places where we can. Also fix some other issues + reported by clang-tidy. +- Various other code cleanups. +- Modernize documentation config, CMake config and CI workflows. + +### Fixed + +- `basic_pbf_builder` constructor can not be noexcept. + + ## [1.7.1] - 2022-01-10 ### Changed @@ -399,7 +417,8 @@ This project adheres to [Semantic Versioning](https://semver.org/). - Make pbf reader and writer code endianess-aware. -[unreleased]: https://github.com/osmcode/libosmium/compare/v1.7.1...HEAD +[unreleased]: https://github.com/osmcode/libosmium/compare/v1.8.0...HEAD +[1.8.0]: https://github.com/osmcode/libosmium/compare/v1.7.1...v1.8.0 [1.7.1]: https://github.com/osmcode/libosmium/compare/v1.7.0...v1.7.1 [1.7.0]: https://github.com/osmcode/libosmium/compare/v1.6.8...v1.7.0 [1.6.8]: https://github.com/osmcode/libosmium/compare/v1.6.7...v1.6.8 diff --git a/ext/protozero/LICENSE.md b/ext/protozero/LICENSE.md index d0b30117c1..5c2ce01d11 100644 --- a/ext/protozero/LICENSE.md +++ b/ext/protozero/LICENSE.md @@ -1,15 +1,17 @@ -protozero copyright (c) Mapbox. +Copyright (C) 2022, Mapbox. +All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, diff --git a/ext/protozero/include/protozero/basic_pbf_builder.hpp b/ext/protozero/include/protozero/basic_pbf_builder.hpp index 0ede726faf..ce7640d43f 100644 --- a/ext/protozero/include/protozero/basic_pbf_builder.hpp +++ b/ext/protozero/include/protozero/basic_pbf_builder.hpp @@ -40,7 +40,7 @@ namespace protozero { template class basic_pbf_builder : public basic_pbf_writer { - static_assert(std::is_same::type>::value, + static_assert(std::is_same>::value, "T must be enum with underlying type protozero::pbf_tag_type"); public: @@ -67,7 +67,7 @@ public: * @param tag Tag of the field that will be written */ template - basic_pbf_builder(basic_pbf_writer& parent_writer, P tag) noexcept : + basic_pbf_builder(basic_pbf_writer& parent_writer, P tag) : basic_pbf_writer{parent_writer, pbf_tag_type(tag)} { } diff --git a/ext/protozero/include/protozero/basic_pbf_writer.hpp b/ext/protozero/include/protozero/basic_pbf_writer.hpp index f167c4d1d5..c26ba67cd5 100644 --- a/ext/protozero/include/protozero/basic_pbf_writer.hpp +++ b/ext/protozero/include/protozero/basic_pbf_writer.hpp @@ -85,7 +85,7 @@ class basic_pbf_writer { void add_field(pbf_tag_type tag, pbf_wire_type type) { protozero_assert(((tag > 0 && tag < 19000) || (tag > 19999 && tag <= ((1U << 29U) - 1))) && "tag out of range"); - const uint32_t b = (tag << 3U) | uint32_t(type); + const uint32_t b = (tag << 3U) | static_cast(type); add_varint(b); } @@ -105,7 +105,7 @@ class basic_pbf_writer { } template - void add_packed_fixed(pbf_tag_type tag, It first, It last, std::input_iterator_tag /*unused*/) { + void add_packed_fixed(pbf_tag_type tag, It first, It last, std::input_iterator_tag /*unused*/) { // NOLINT(performance-unnecessary-value-param) if (first == last) { return; } @@ -118,7 +118,7 @@ class basic_pbf_writer { } template - void add_packed_fixed(pbf_tag_type tag, It first, It last, std::forward_iterator_tag /*unused*/) { + void add_packed_fixed(pbf_tag_type tag, It first, It last, std::forward_iterator_tag /*unused*/) { // NOLINT(performance-unnecessary-value-param) if (first == last) { return; } @@ -133,7 +133,7 @@ class basic_pbf_writer { } template - void add_packed_varint(pbf_tag_type tag, It first, It last) { + void add_packed_varint(pbf_tag_type tag, It first, It last) { // NOLINT(performance-unnecessary-value-param) if (first == last) { return; } @@ -146,7 +146,7 @@ class basic_pbf_writer { } template - void add_packed_svarint(pbf_tag_type tag, It first, It last) { + void add_packed_svarint(pbf_tag_type tag, It first, It last) { // NOLINT(performance-unnecessary-value-param) if (first == last) { return; } @@ -162,7 +162,7 @@ class basic_pbf_writer { // a length-delimited field. The length has to fit into pbf_length_type, // and a varint needs 8 bit for every 7 bit. enum : int { - reserve_bytes = sizeof(pbf_length_type) * 8 / 7 + 1 + reserve_bytes = (sizeof(pbf_length_type) * 8 / 7) + 1 }; // If m_rollpack_pos is set to this special value, it means that when @@ -181,7 +181,7 @@ class basic_pbf_writer { buffer_customization::append_zeros(m_data, std::size_t(reserve_bytes)); } else { m_rollback_pos = size_is_known; - add_length_varint(tag, pbf_length_type(size)); + add_length_varint(tag, static_cast(size)); reserve(size); } m_pos = buffer_customization::size(m_data); @@ -391,7 +391,7 @@ public: add_field(tag, pbf_wire_type::varint); protozero_assert(m_pos == 0 && "you can't add fields to a parent basic_pbf_writer if there is an existing basic_pbf_writer for a submessage"); protozero_assert(m_data); - m_data->push_back(char(value)); + m_data->push_back(static_cast(value)); } /** @@ -401,7 +401,7 @@ public: * @param value Value to be written */ void add_enum(pbf_tag_type tag, int32_t value) { - add_tagged_varint(tag, uint64_t(value)); + add_tagged_varint(tag, static_cast(value)); } /** @@ -411,7 +411,7 @@ public: * @param value Value to be written */ void add_int32(pbf_tag_type tag, int32_t value) { - add_tagged_varint(tag, uint64_t(value)); + add_tagged_varint(tag, static_cast(value)); } /** @@ -441,7 +441,7 @@ public: * @param value Value to be written */ void add_int64(pbf_tag_type tag, int64_t value) { - add_tagged_varint(tag, uint64_t(value)); + add_tagged_varint(tag, static_cast(value)); } /** @@ -541,7 +541,7 @@ public: protozero_assert(m_pos == 0 && "you can't add fields to a parent basic_pbf_writer if there is an existing basic_pbf_writer for a submessage"); protozero_assert(m_data); protozero_assert(size <= std::numeric_limits::max()); - add_length_varint(tag, pbf_length_type(size)); + add_length_varint(tag, static_cast(size)); buffer_customization::append(m_data, value, size); } @@ -602,7 +602,7 @@ public: size_t sum_size = 0; (void)std::initializer_list{sum_size += values.size()...}; protozero_assert(sum_size <= std::numeric_limits::max()); - add_length_varint(tag, pbf_length_type(sum_size)); + add_length_varint(tag, static_cast(sum_size)); buffer_customization::reserve_additional(m_data, sum_size); (void)std::initializer_list{(buffer_customization::append(m_data, values.data(), values.size()), 0)...}; } @@ -697,7 +697,7 @@ public: * @param last Iterator pointing one past the end of data */ template - void add_packed_bool(pbf_tag_type tag, InputIterator first, InputIterator last) { + void add_packed_bool(pbf_tag_type tag, InputIterator first, InputIterator last) { // NOLINT(performance-unnecessary-value-param) add_packed_varint(tag, first, last); } @@ -711,7 +711,7 @@ public: * @param last Iterator pointing one past the end of data */ template - void add_packed_enum(pbf_tag_type tag, InputIterator first, InputIterator last) { + void add_packed_enum(pbf_tag_type tag, InputIterator first, InputIterator last) { // NOLINT(performance-unnecessary-value-param) add_packed_varint(tag, first, last); } @@ -725,7 +725,7 @@ public: * @param last Iterator pointing one past the end of data */ template - void add_packed_int32(pbf_tag_type tag, InputIterator first, InputIterator last) { + void add_packed_int32(pbf_tag_type tag, InputIterator first, InputIterator last) { // NOLINT(performance-unnecessary-value-param) add_packed_varint(tag, first, last); } @@ -739,7 +739,7 @@ public: * @param last Iterator pointing one past the end of data */ template - void add_packed_sint32(pbf_tag_type tag, InputIterator first, InputIterator last) { + void add_packed_sint32(pbf_tag_type tag, InputIterator first, InputIterator last) { // NOLINT(performance-unnecessary-value-param) add_packed_svarint(tag, first, last); } @@ -753,7 +753,7 @@ public: * @param last Iterator pointing one past the end of data */ template - void add_packed_uint32(pbf_tag_type tag, InputIterator first, InputIterator last) { + void add_packed_uint32(pbf_tag_type tag, InputIterator first, InputIterator last) { // NOLINT(performance-unnecessary-value-param) add_packed_varint(tag, first, last); } @@ -767,7 +767,7 @@ public: * @param last Iterator pointing one past the end of data */ template - void add_packed_int64(pbf_tag_type tag, InputIterator first, InputIterator last) { + void add_packed_int64(pbf_tag_type tag, InputIterator first, InputIterator last) { // NOLINT(performance-unnecessary-value-param) add_packed_varint(tag, first, last); } @@ -781,7 +781,7 @@ public: * @param last Iterator pointing one past the end of data */ template - void add_packed_sint64(pbf_tag_type tag, InputIterator first, InputIterator last) { + void add_packed_sint64(pbf_tag_type tag, InputIterator first, InputIterator last) { // NOLINT(performance-unnecessary-value-param) add_packed_svarint(tag, first, last); } @@ -795,7 +795,7 @@ public: * @param last Iterator pointing one past the end of data */ template - void add_packed_uint64(pbf_tag_type tag, InputIterator first, InputIterator last) { + void add_packed_uint64(pbf_tag_type tag, InputIterator first, InputIterator last) { // NOLINT(performance-unnecessary-value-param) add_packed_varint(tag, first, last); } @@ -817,7 +817,7 @@ public: * @param last Iterator pointing one past the end of data */ template - void add_packed_fixed(pbf_tag_type tag, InputIterator first, InputIterator last) { + void add_packed_fixed(pbf_tag_type tag, InputIterator first, InputIterator last) { // NOLINT(performance-unnecessary-value-param) static_assert(std::is_same::value || std::is_same::value || std::is_same::value || @@ -838,7 +838,7 @@ public: * @param last Iterator pointing one past the end of data */ template - void add_packed_fixed32(pbf_tag_type tag, InputIterator first, InputIterator last) { + void add_packed_fixed32(pbf_tag_type tag, InputIterator first, InputIterator last) { // NOLINT(performance-unnecessary-value-param) add_packed_fixed(tag, first, last, typename std::iterator_traits::iterator_category{}); } @@ -853,7 +853,7 @@ public: * @param last Iterator pointing one past the end of data */ template - void add_packed_sfixed32(pbf_tag_type tag, InputIterator first, InputIterator last) { + void add_packed_sfixed32(pbf_tag_type tag, InputIterator first, InputIterator last) { // NOLINT(performance-unnecessary-value-param) add_packed_fixed(tag, first, last, typename std::iterator_traits::iterator_category{}); } @@ -868,7 +868,7 @@ public: * @param last Iterator pointing one past the end of data */ template - void add_packed_fixed64(pbf_tag_type tag, InputIterator first, InputIterator last) { + void add_packed_fixed64(pbf_tag_type tag, InputIterator first, InputIterator last) { // NOLINT(performance-unnecessary-value-param) add_packed_fixed(tag, first, last, typename std::iterator_traits::iterator_category{}); } @@ -883,7 +883,7 @@ public: * @param last Iterator pointing one past the end of data */ template - void add_packed_sfixed64(pbf_tag_type tag, InputIterator first, InputIterator last) { + void add_packed_sfixed64(pbf_tag_type tag, InputIterator first, InputIterator last) { // NOLINT(performance-unnecessary-value-param) add_packed_fixed(tag, first, last, typename std::iterator_traits::iterator_category{}); } @@ -898,7 +898,7 @@ public: * @param last Iterator pointing one past the end of data */ template - void add_packed_float(pbf_tag_type tag, InputIterator first, InputIterator last) { + void add_packed_float(pbf_tag_type tag, InputIterator first, InputIterator last) { // NOLINT(performance-unnecessary-value-param) add_packed_fixed(tag, first, last, typename std::iterator_traits::iterator_category{}); } @@ -913,7 +913,7 @@ public: * @param last Iterator pointing one past the end of data */ template - void add_packed_double(pbf_tag_type tag, InputIterator first, InputIterator last) { + void add_packed_double(pbf_tag_type tag, InputIterator first, InputIterator last) { // NOLINT(performance-unnecessary-value-param) add_packed_fixed(tag, first, last, typename std::iterator_traits::iterator_category{}); } diff --git a/ext/protozero/include/protozero/buffer_string.hpp b/ext/protozero/include/protozero/buffer_string.hpp index 02e8ad25b6..c620879e45 100644 --- a/ext/protozero/include/protozero/buffer_string.hpp +++ b/ext/protozero/include/protozero/buffer_string.hpp @@ -57,8 +57,8 @@ struct buffer_customization { protozero_assert(from <= buffer->size()); protozero_assert(to <= buffer->size()); protozero_assert(from <= to); - buffer->erase(std::next(buffer->begin(), static_cast(from)), - std::next(buffer->begin(), static_cast(to))); + buffer->erase(buffer->begin() + static_cast(from), + buffer->begin() + static_cast(to)); } static char* at_pos(std::string* buffer, std::size_t pos) { diff --git a/ext/protozero/include/protozero/data_view.hpp b/ext/protozero/include/protozero/data_view.hpp index 3ec87af34e..815ceb3d24 100644 --- a/ext/protozero/include/protozero/data_view.hpp +++ b/ext/protozero/include/protozero/data_view.hpp @@ -173,7 +173,7 @@ inline void swap(data_view& lhs, data_view& rhs) noexcept { * @param lhs First object. * @param rhs Second object. */ -inline constexpr bool operator==(const data_view lhs, const data_view rhs) noexcept { +constexpr bool operator==(const data_view lhs, const data_view rhs) noexcept { return lhs.size() == rhs.size() && std::equal(lhs.data(), lhs.data() + lhs.size(), rhs.data()); } @@ -185,7 +185,7 @@ inline constexpr bool operator==(const data_view lhs, const data_view rhs) noexc * @param lhs First object. * @param rhs Second object. */ -inline constexpr bool operator!=(const data_view lhs, const data_view rhs) noexcept { +constexpr bool operator!=(const data_view lhs, const data_view rhs) noexcept { return !(lhs == rhs); } diff --git a/ext/protozero/include/protozero/pbf_message.hpp b/ext/protozero/include/protozero/pbf_message.hpp index d7fd8b5d0d..393078b9bf 100644 --- a/ext/protozero/include/protozero/pbf_message.hpp +++ b/ext/protozero/include/protozero/pbf_message.hpp @@ -64,7 +64,7 @@ namespace protozero { template class pbf_message : public pbf_reader { - static_assert(std::is_same::type>::value, + static_assert(std::is_same>::value, "T must be enum with underlying type protozero::pbf_tag_type"); public: diff --git a/ext/protozero/include/protozero/pbf_reader.hpp b/ext/protozero/include/protozero/pbf_reader.hpp index 92bfdee5ea..297683afe6 100644 --- a/ext/protozero/include/protozero/pbf_reader.hpp +++ b/ext/protozero/include/protozero/pbf_reader.hpp @@ -76,9 +76,9 @@ class pbf_reader { template T get_fixed() { T result; - const char* data = m_data; + const char* tmp_data = m_data; skip_bytes(sizeof(T)); - std::memcpy(&result, data, sizeof(T)); + std::memcpy(&result, tmp_data, sizeof(T)); #if PROTOZERO_BYTE_ORDER != PROTOZERO_LITTLE_ENDIAN byteswap_inplace(&result); #endif @@ -263,7 +263,7 @@ public: * and how it is encoded for this number to have any meaning. */ std::size_t length() const noexcept { - return std::size_t(m_end - m_data); + return static_cast(m_end - m_data); } /** @@ -287,7 +287,7 @@ public: } const auto value = get_varint(); - m_tag = pbf_tag_type(value >> 3U); + m_tag = static_cast(value >> 3U); // tags 0 and 19000 to 19999 are not allowed as per // https://developers.google.com/protocol-buffers/docs/proto#assigning-tags diff --git a/ext/protozero/include/protozero/types.hpp b/ext/protozero/include/protozero/types.hpp index 3aefddfb51..ad9c362ff2 100644 --- a/ext/protozero/include/protozero/types.hpp +++ b/ext/protozero/include/protozero/types.hpp @@ -52,7 +52,7 @@ enum class pbf_wire_type : uint32_t { * See pbf_reader.tag_and_type() for an example how to use this. */ template -constexpr inline uint32_t tag_and_type(T tag, pbf_wire_type wire_type) noexcept { +constexpr uint32_t tag_and_type(T tag, pbf_wire_type wire_type) noexcept { return (static_cast(static_cast(tag)) << 3U) | static_cast(wire_type); } diff --git a/ext/protozero/include/protozero/varint.hpp b/ext/protozero/include/protozero/varint.hpp index b4648a4421..5c7fcec752 100644 --- a/ext/protozero/include/protozero/varint.hpp +++ b/ext/protozero/include/protozero/varint.hpp @@ -26,7 +26,7 @@ namespace protozero { /** * The maximum length of a 64 bit varint. */ -constexpr const int8_t max_varint_length = sizeof(uint64_t) * 8 / 7 + 1; +constexpr const int8_t max_varint_length = (sizeof(uint64_t) * 8 / 7) + 1; namespace detail { @@ -40,28 +40,28 @@ namespace detail { if (iend - begin >= max_varint_length) { // fast path do { int64_t b = *p++; - val = ((uint64_t(b) & 0x7fU) ); if (b >= 0) { break; } - b = *p++; val |= ((uint64_t(b) & 0x7fU) << 7U); if (b >= 0) { break; } - b = *p++; val |= ((uint64_t(b) & 0x7fU) << 14U); if (b >= 0) { break; } - b = *p++; val |= ((uint64_t(b) & 0x7fU) << 21U); if (b >= 0) { break; } - b = *p++; val |= ((uint64_t(b) & 0x7fU) << 28U); if (b >= 0) { break; } - b = *p++; val |= ((uint64_t(b) & 0x7fU) << 35U); if (b >= 0) { break; } - b = *p++; val |= ((uint64_t(b) & 0x7fU) << 42U); if (b >= 0) { break; } - b = *p++; val |= ((uint64_t(b) & 0x7fU) << 49U); if (b >= 0) { break; } - b = *p++; val |= ((uint64_t(b) & 0x7fU) << 56U); if (b >= 0) { break; } - b = *p++; val |= ((uint64_t(b) & 0x01U) << 63U); if (b >= 0) { break; } + val = ((static_cast(b) & 0x7fU) ); if (b >= 0) { break; } + b = *p++; val |= ((static_cast(b) & 0x7fU) << 7U); if (b >= 0) { break; } + b = *p++; val |= ((static_cast(b) & 0x7fU) << 14U); if (b >= 0) { break; } + b = *p++; val |= ((static_cast(b) & 0x7fU) << 21U); if (b >= 0) { break; } + b = *p++; val |= ((static_cast(b) & 0x7fU) << 28U); if (b >= 0) { break; } + b = *p++; val |= ((static_cast(b) & 0x7fU) << 35U); if (b >= 0) { break; } + b = *p++; val |= ((static_cast(b) & 0x7fU) << 42U); if (b >= 0) { break; } + b = *p++; val |= ((static_cast(b) & 0x7fU) << 49U); if (b >= 0) { break; } + b = *p++; val |= ((static_cast(b) & 0x7fU) << 56U); if (b >= 0) { break; } + b = *p++; val |= ((static_cast(b) & 0x01U) << 63U); if (b >= 0) { break; } throw varint_too_long_exception{}; } while (false); } else { unsigned int shift = 0; while (p != iend && *p < 0) { - val |= (uint64_t(*p++) & 0x7fU) << shift; + val |= (static_cast(*p++) & 0x7fU) << shift; shift += 7; } if (p == iend) { throw end_of_buffer_exception{}; } - val |= uint64_t(*p++) << shift; + val |= static_cast(*p++) << shift; } *data = reinterpret_cast(p); @@ -148,11 +148,11 @@ inline int write_varint(T data, uint64_t value) { int n = 1; while (value >= 0x80U) { - *data++ = char((value & 0x7fU) | 0x80U); + *data++ = static_cast((value & 0x7fU) | 0x80U); value >>= 7U; ++n; } - *data = char(value); + *data = static_cast(value); return n; } @@ -163,16 +163,15 @@ inline int write_varint(T data, uint64_t value) { * @tparam TBuffer A buffer type. * @param buffer Output buffer the varint will be written to. * @param value The integer that will be encoded. - * @returns the number of bytes written * @throws Any exception thrown by calling the buffer_push_back() function. */ template inline void add_varint_to_buffer(TBuffer* buffer, uint64_t value) { while (value >= 0x80U) { - buffer_customization::push_back(buffer, char((value & 0x7fU) | 0x80U)); + buffer_customization::push_back(buffer, static_cast((value & 0x7fU) | 0x80U)); value >>= 7U; } - buffer_customization::push_back(buffer, char(value)); + buffer_customization::push_back(buffer, static_cast(value)); } /** @@ -186,11 +185,11 @@ inline int add_varint_to_buffer(char* data, uint64_t value) noexcept { int n = 1; while (value >= 0x80U) { - *data++ = char((value & 0x7fU) | 0x80U); + *data++ = static_cast((value & 0x7fU) | 0x80U); value >>= 7U; ++n; } - *data = char(value); + *data = static_cast(value); return n; } @@ -215,28 +214,28 @@ inline int length_of_varint(uint64_t value) noexcept { /** * ZigZag encodes a 32 bit integer. */ -inline constexpr uint32_t encode_zigzag32(int32_t value) noexcept { +constexpr uint32_t encode_zigzag32(int32_t value) noexcept { return (static_cast(value) << 1U) ^ static_cast(-static_cast(static_cast(value) >> 31U)); } /** * ZigZag encodes a 64 bit integer. */ -inline constexpr uint64_t encode_zigzag64(int64_t value) noexcept { +constexpr uint64_t encode_zigzag64(int64_t value) noexcept { return (static_cast(value) << 1U) ^ static_cast(-static_cast(static_cast(value) >> 63U)); } /** * Decodes a 32 bit ZigZag-encoded integer. */ -inline constexpr int32_t decode_zigzag32(uint32_t value) noexcept { +constexpr int32_t decode_zigzag32(uint32_t value) noexcept { return static_cast((value >> 1U) ^ static_cast(-static_cast(value & 1U))); } /** * Decodes a 64 bit ZigZag-encoded integer. */ -inline constexpr int64_t decode_zigzag64(uint64_t value) noexcept { +constexpr int64_t decode_zigzag64(uint64_t value) noexcept { return static_cast((value >> 1U) ^ static_cast(-static_cast(value & 1U))); } diff --git a/ext/protozero/include/protozero/version.hpp b/ext/protozero/include/protozero/version.hpp index fc9b92879c..18e31cd472 100644 --- a/ext/protozero/include/protozero/version.hpp +++ b/ext/protozero/include/protozero/version.hpp @@ -20,15 +20,15 @@ documentation. #define PROTOZERO_VERSION_MAJOR 1 /// The minor version number -#define PROTOZERO_VERSION_MINOR 7 +#define PROTOZERO_VERSION_MINOR 8 /// The patch number -#define PROTOZERO_VERSION_PATCH 1 +#define PROTOZERO_VERSION_PATCH 0 /// The complete version number #define PROTOZERO_VERSION_CODE (PROTOZERO_VERSION_MAJOR * 10000 + PROTOZERO_VERSION_MINOR * 100 + PROTOZERO_VERSION_PATCH) /// Version number as string -#define PROTOZERO_VERSION_STRING "1.7.1" +#define PROTOZERO_VERSION_STRING "1.8.0" #endif // PROTOZERO_VERSION_HPP -- 2.47.2