diff options
author | qrort <qrort@yandex-team.com> | 2022-11-30 23:47:12 +0300 |
---|---|---|
committer | qrort <qrort@yandex-team.com> | 2022-11-30 23:47:12 +0300 |
commit | 22f8ae0e3f5d68b92aecccdf96c1d841a0334311 (patch) | |
tree | bffa27765faf54126ad44bcafa89fadecb7a73d7 /library/cpp/skiff/skiff-inl.h | |
parent | 332b99e2173f0425444abb759eebcb2fafaa9209 (diff) | |
download | ydb-22f8ae0e3f5d68b92aecccdf96c1d841a0334311.tar.gz |
validate canons without yatest_common
Diffstat (limited to 'library/cpp/skiff/skiff-inl.h')
-rw-r--r-- | library/cpp/skiff/skiff-inl.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/library/cpp/skiff/skiff-inl.h b/library/cpp/skiff/skiff-inl.h new file mode 100644 index 0000000000..a3f68a9374 --- /dev/null +++ b/library/cpp/skiff/skiff-inl.h @@ -0,0 +1,39 @@ +#pragma once + +#ifndef SKIFF_H +#error "Direct inclusion of this file is not allowed, include skiff.h" +// For the sake of sane code completion. +#include "skiff.h" +#endif +#undef SKIFF_H + +namespace NSkiff { + +//////////////////////////////////////////////////////////////////////////////// + +template <EWireType wireType> +constexpr auto TUnderlyingIntegerType<wireType>::F() { + if constexpr (wireType == EWireType::Int8) { + return i8{}; + } else if constexpr (wireType == EWireType::Int16) { + return i16{}; + } else if constexpr (wireType == EWireType::Int32) { + return i32{}; + } else if constexpr (wireType == EWireType::Int64) { + return i64{}; + } else if constexpr (wireType == EWireType::Uint8) { + return ui8{}; + } else if constexpr (wireType == EWireType::Uint16) { + return ui16{}; + } else if constexpr (wireType == EWireType::Uint32) { + return ui32{}; + } else if constexpr (wireType == EWireType::Uint64) { + return ui64{}; + } else { + static_assert(wireType == EWireType::Int8, "expected integer wire type"); + } +} + +//////////////////////////////////////////////////////////////////////////////// + +} // namespace NSkiff |