definition.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #pragma once
  2. #include <cstddef>
  3. #include <cstdint>
  4. #include "../details/definition.h"
  5. namespace sunrise::state::build_data::items::socket_plugs {
  6. /** Ordinary item instances expose at most 12 socket lanes. */
  7. inline constexpr std::size_t kLaneCapacity = details::kInitialPlugCapacity;
  8. /** At most one exact pool rule is retained for each installed item and ordinary socket lane. */
  9. inline constexpr std::size_t kRuleCapacity = details::kDefinitionCapacity * kLaneCapacity;
  10. /** Pool zero is the shared empty pool, in addition to at most one unique pool per rule. */
  11. inline constexpr std::size_t kPoolCapacity = kRuleCapacity + 1;
  12. /** Four million 16-bit members bound the deduplicated installed-build relation to 8 MiB. */
  13. inline constexpr std::size_t kMemberCapacity = 1U << 22U;
  14. /** Pool zero is always the canonical empty pool. */
  15. inline constexpr std::uint32_t kEmptyPoolIndex = 0;
  16. /** One installed item socket and the exact deduplicated plug pool it accepts. */
  17. struct Rule {
  18. std::uint16_t itemDefinitionIndex{};
  19. std::uint8_t lane{};
  20. /** Must remain zero so the runtime and packed forms are deterministic. */
  21. std::uint8_t reserved{};
  22. std::uint32_t poolIndex{};
  23. };
  24. /** One contiguous range in the flat, sorted plug-definition index bank. */
  25. struct Pool {
  26. std::uint32_t memberOffset{};
  27. std::uint32_t memberCount{};
  28. };
  29. /** Native item-definition index of one allowed plug. */
  30. using Member = std::uint16_t;
  31. } // namespace sunrise::state::build_data::items::socket_plugs