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

fixed_width_integer.hpp bug #14

Open
KostinPavel opened this issue Nov 8, 2022 · 1 comment
Open

fixed_width_integer.hpp bug #14

KostinPavel opened this issue Nov 8, 2022 · 1 comment

Comments

@KostinPavel
Copy link

KostinPavel commented Nov 8, 2022

Mismatch of the type for the shifted value with the result type leads to errors for int64_t and uint64_t.
erorr use sufix ul:

    static constexpr auto sign_bit = [](size_t num_bytes) -> uint64_t {
      return 0x80ul << (num_bytes * 8);
    };

    static constexpr auto multiplier = [](size_t num_bytes) -> uint64_t {
      return 0x1ul << (num_bytes * 8);
    };

need use sufix ull:

static constexpr auto sign_bit = [](size_t num_bytes) -> uint64_t {
      return 0x80ull << (num_bytes * 8);
    };

    static constexpr auto multiplier = [](size_t num_bytes) -> uint64_t {
      return 0x1ull << (num_bytes * 8);
    };

additionally, for correct use macros OUTCOME_TRY with different compilers, you need to add a keyword auto before variable name.
For smarter compilers:

OUTCOME_TRY(var_name ...)

For less smart compilers need add auto before variable name

OUTCOME_TRY(auto var_name ...)
@KostinPavel
Copy link
Author

KostinPavel commented Nov 9, 2022

I have changed the original content. This is the message to notify about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant