Skip to content

src/scale/types.hpp

Namespaces

Name
sgns
sgns::scale
sgns::scale::compact

Classes

Name
struct sgns::scale::compact::EncodingCategoryLimits
categories of compact encoding

Types

Name
enum class uint8_t OptionalBool { NONE_ = 0u, FALSE_ = 1u, TRUE_ = 2u}
OptionalBool is internal extended bool type.
using std::vector< uint8_t > ByteArray
convenience alias for arrays of bytes
using boost::multiprecision::cpp_int CompactInteger
represents compact integer value

Types Documentation

enum OptionalBool

Enumerator Value Description
NONE_ 0u
FALSE_ 1u
TRUE_ 2u

OptionalBool is internal extended bool type.

using ByteArray

using sgns::scale::ByteArray = std::vector<uint8_t>;

convenience alias for arrays of bytes

using CompactInteger

using sgns::scale::CompactInteger = boost::multiprecision::cpp_int;

represents compact integer value

Source code

#ifndef SUPERGENIUS_SCALE_TYPES_HPP
#define SUPERGENIUS_SCALE_TYPES_HPP

#include <vector>

#include <boost/multiprecision/cpp_int.hpp>
#include "outcome/outcome.hpp"

namespace sgns::scale {
  using ByteArray = std::vector<uint8_t>;
  using CompactInteger = boost::multiprecision::cpp_int;

  enum class OptionalBool : uint8_t { NONE_ = 0u, FALSE_ = 1u, TRUE_ = 2u };
}  // namespace sgns::scale

namespace sgns::scale::compact {
  struct EncodingCategoryLimits {
    // min integer encoded by 2 bytes
    constexpr static size_t kMinUint16 = (1ul << 6u);
    // min integer encoded by 4 bytes
    constexpr static size_t kMinUint32 = (1ul << 14u);
    // min integer encoded as multibyte
    constexpr static size_t kMinBigInteger = (1ul << 30u);
  };
}  // namespace sgns::scale::compact
#endif  // SUPERGENIUS_SCALE_TYPES_HPP

Updated on 2026-03-04 at 13:10:45 -0800