Skip to content

fixed_width_integer.hpp bug #14

Description

@KostinPavel

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 ...)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions