| // WARNING: This file is machine generated by fidlgen. |
| |
| // fidl_experiment = output_index_json |
| |
| #pragma once |
| |
| #include <fidl/test.bitsconstants/cpp/common_types.h> |
| #include <fidl/test.bitsconstants/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_bitsconstants { |
| |
| constexpr ::test_bitsconstants::BitsType kConst0 = static_cast<::test_bitsconstants::BitsType>(0u); |
| |
| constexpr ::test_bitsconstants::BitsType kConst1 = ::test_bitsconstants::BitsType::kA; |
| |
| constexpr ::test_bitsconstants::BitsType kConst2 = static_cast<::test_bitsconstants::BitsType>(129); |
| |
| constexpr ::test_bitsconstants::BitsType kConst3 = static_cast<::test_bitsconstants::BitsType>(131); |
| |
| } // namespace test_bitsconstants |
| namespace fidl { |
| |
| template <> |
| struct internal::NaturalCodingTraits<::test_bitsconstants::BitsType, ::fidl::internal::NaturalCodingConstraintEmpty> { |
| static constexpr size_t kInlineSize = sizeof(uint32_t); |
| static constexpr bool kIsMemcpyCompatible = false; |
| |
| static void Encode(internal::NaturalEncoder* encoder, ::test_bitsconstants::BitsType* value, size_t offset, size_t recursion_depth) { |
| if (unlikely(static_cast<uint32_t>(*value) & ~131ull)) { |
| encoder->SetError(::fidl::internal::kCodingErrorUnknownBitSetInBitsValue); |
| } |
| *encoder->template GetPtr<::test_bitsconstants::BitsType>(offset) = *value; |
| } |
| static void Decode(internal::NaturalDecoder* decoder, ::test_bitsconstants::BitsType* value, size_t offset, size_t recursion_depth) { |
| *value = *decoder->template GetPtr<::test_bitsconstants::BitsType>(offset); |
| if (unlikely(static_cast<uint32_t>(*value) & ~131ull)) { |
| decoder->SetError(::fidl::internal::kCodingErrorUnknownBitSetInBitsValue); |
| } |
| } |
| }; |
| |
| #pragma clang diagnostic pop |
| |
| } // namespace fidl |