Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cpp: Fallback to evmc::is_zero() in case the deprecated ::is_zero() is used #406

Merged
merged 1 commit into from
Aug 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ and this project adheres to [Semantic Versioning].

- Added `LoadAndConfigure` method to the Go API.
[[#404](https://github.com/ethereum/evmc/pull/404)]

### Deprecated

- Previously deprecated `is_zero()` helper has been removed,
but replaced with new `evmc::is_zero()` in API compatible way.
[[#406](https://github.com/ethereum/evmc/pull/406)]

### Fixed

Expand Down
20 changes: 3 additions & 17 deletions include/evmc/helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@
*/
#pragma once

#include <evmc/evmc.h>
#include <evmc/evmc.hpp>

#include <cstring>
#include <functional>

using evmc::is_zero;

/// The comparator for std::map<evmc_address, ...>.
EVMC_DEPRECATED
inline bool operator<(const evmc_address& a, const evmc_address& b)
Expand Down Expand Up @@ -45,22 +47,6 @@ inline bool operator==(const evmc_bytes32& a, const evmc_bytes32& b)
return std::memcmp(a.bytes, b.bytes, sizeof(a.bytes)) == 0;
}

/// Check if the address is zero (all bytes are zeros).
EVMC_DEPRECATED
inline bool is_zero(const evmc_address& address) noexcept
{
constexpr auto zero = evmc_address{};
return std::memcmp(address.bytes, zero.bytes, sizeof(zero.bytes)) == 0;
}

/// Check if the hash is zero (all bytes are zeros).
EVMC_DEPRECATED
inline bool is_zero(const evmc_bytes32& x) noexcept
{
constexpr auto zero = evmc_bytes32{};
return std::memcmp(x.bytes, zero.bytes, sizeof(zero.bytes)) == 0;
}

/// Parameters for the fnv1a hash function, specialized by the hash result size (size_t).
///
/// The values for the matching size are taken from
Expand Down