skiff-inl.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #pragma once
  2. #ifndef SKIFF_H
  3. #error "Direct inclusion of this file is not allowed, include skiff.h"
  4. // For the sake of sane code completion.
  5. #include "skiff.h"
  6. #endif
  7. #undef SKIFF_H
  8. namespace NSkiff {
  9. ////////////////////////////////////////////////////////////////////////////////
  10. template <EWireType wireType>
  11. constexpr auto TUnderlyingIntegerType<wireType>::F() {
  12. if constexpr (wireType == EWireType::Int8) {
  13. return i8{};
  14. } else if constexpr (wireType == EWireType::Int16) {
  15. return i16{};
  16. } else if constexpr (wireType == EWireType::Int32) {
  17. return i32{};
  18. } else if constexpr (wireType == EWireType::Int64) {
  19. return i64{};
  20. } else if constexpr (wireType == EWireType::Uint8) {
  21. return ui8{};
  22. } else if constexpr (wireType == EWireType::Uint16) {
  23. return ui16{};
  24. } else if constexpr (wireType == EWireType::Uint32) {
  25. return ui32{};
  26. } else if constexpr (wireType == EWireType::Uint64) {
  27. return ui64{};
  28. } else {
  29. static_assert(wireType == EWireType::Int8, "expected integer wire type");
  30. }
  31. }
  32. ////////////////////////////////////////////////////////////////////////////////
  33. } // namespace NSkiff