| // WARNING: This file is machine generated by fidlgen. |
| |
| // fidl_experiment = output_index_json |
| |
| #pragma once |
| |
| #include <fidl/test.bits/cpp/common_types.h> |
| #include <fidl/test.bits/cpp/markers.h> |
| #include <lib/fidl/cpp/natural_coding_traits.h> |
| #include <lib/fidl/cpp/natural_types.h> |
| |
| #include <cinttypes> |
| #include <string> |
| |
| #ifdef __Fuchsia__ |
| |
| #endif // __Fuchsia__ |
| |
| #pragma clang diagnostic push |
| #pragma clang diagnostic ignored "-Wshadow" |
| |
| namespace test_bits { |
| |
| } // namespace test_bits |
| namespace fidl { |
| |
| template <> |
| struct internal::NaturalCodingTraits<::test_bits::MyBits, ::fidl::internal::NaturalCodingConstraintEmpty> { |
| static constexpr size_t kInlineSize = sizeof(uint32_t); |
| static constexpr bool kIsMemcpyCompatible = false; |
| |
| static void Encode(internal::NaturalEncoder* encoder, ::test_bits::MyBits* value, size_t offset, size_t recursion_depth) { |
| if (unlikely(static_cast<uint32_t>(*value) & ~7ull)) { |
| encoder->SetError(::fidl::internal::kCodingErrorUnknownBitSetInBitsValue); |
| } |
| *encoder->template GetPtr<::test_bits::MyBits>(offset) = *value; |
| } |
| static void Decode(internal::NaturalDecoder* decoder, ::test_bits::MyBits* value, size_t offset, size_t recursion_depth) { |
| *value = *decoder->template GetPtr<::test_bits::MyBits>(offset); |
| if (unlikely(static_cast<uint32_t>(*value) & ~7ull)) { |
| decoder->SetError(::fidl::internal::kCodingErrorUnknownBitSetInBitsValue); |
| } |
| } |
| }; |
| template <> |
| struct internal::NaturalCodingTraits<::test_bits::StrictBits, ::fidl::internal::NaturalCodingConstraintEmpty> { |
| static constexpr size_t kInlineSize = sizeof(uint64_t); |
| static constexpr bool kIsMemcpyCompatible = false; |
| |
| static void Encode(internal::NaturalEncoder* encoder, ::test_bits::StrictBits* value, size_t offset, size_t recursion_depth) { |
| if (unlikely(static_cast<uint64_t>(*value) & ~9223372036854775809ull)) { |
| encoder->SetError(::fidl::internal::kCodingErrorUnknownBitSetInBitsValue); |
| } |
| *encoder->template GetPtr<::test_bits::StrictBits>(offset) = *value; |
| } |
| static void Decode(internal::NaturalDecoder* decoder, ::test_bits::StrictBits* value, size_t offset, size_t recursion_depth) { |
| *value = *decoder->template GetPtr<::test_bits::StrictBits>(offset); |
| if (unlikely(static_cast<uint64_t>(*value) & ~9223372036854775809ull)) { |
| decoder->SetError(::fidl::internal::kCodingErrorUnknownBitSetInBitsValue); |
| } |
| } |
| }; |
| template <> |
| struct internal::NaturalCodingTraits<::test_bits::FlexibleBits, ::fidl::internal::NaturalCodingConstraintEmpty> { |
| static constexpr size_t kInlineSize = sizeof(uint64_t); |
| static constexpr bool kIsMemcpyCompatible = true; |
| |
| static void Encode(internal::NaturalEncoder* encoder, ::test_bits::FlexibleBits* value, size_t offset, size_t recursion_depth) { |
| *encoder->template GetPtr<::test_bits::FlexibleBits>(offset) = *value; |
| } |
| static void Decode(internal::NaturalDecoder* decoder, ::test_bits::FlexibleBits* value, size_t offset, size_t recursion_depth) { |
| *value = *decoder->template GetPtr<::test_bits::FlexibleBits>(offset); |
| } |
| }; |
| template <> |
| struct internal::NaturalCodingTraits<::test_bits::EmptyBits, ::fidl::internal::NaturalCodingConstraintEmpty> { |
| static constexpr size_t kInlineSize = sizeof(uint32_t); |
| static constexpr bool kIsMemcpyCompatible = true; |
| |
| static void Encode(internal::NaturalEncoder* encoder, ::test_bits::EmptyBits* value, size_t offset, size_t recursion_depth) { |
| *encoder->template GetPtr<::test_bits::EmptyBits>(offset) = *value; |
| } |
| static void Decode(internal::NaturalDecoder* decoder, ::test_bits::EmptyBits* value, size_t offset, size_t recursion_depth) { |
| *value = *decoder->template GetPtr<::test_bits::EmptyBits>(offset); |
| } |
| }; |
| |
| #pragma clang diagnostic pop |
| |
| } // namespace fidl |