| 811 | |
| 812 | template <typename FieldType, typename StructT, size_t Index, int8_t NodeIndex> |
| 813 | FORY_ALWAYS_INLINE FieldType read_configured_scalar(ReadContext &ctx) { |
| 814 | if constexpr (is_configurable_int_v<FieldType>) { |
| 815 | constexpr Encoding enc = |
| 816 | configured_node_encoding<StructT, Index, NodeIndex>(); |
| 817 | if constexpr (std::is_same_v<FieldType, uint32_t>) { |
| 818 | if constexpr (enc == Encoding::Fixed) { |
| 819 | return static_cast<FieldType>(ctx.read_int32(ctx.error())); |
| 820 | } |
| 821 | return static_cast<FieldType>(ctx.read_var_uint32(ctx.error())); |
| 822 | } else if constexpr (std::is_same_v<FieldType, uint64_t>) { |
| 823 | if constexpr (enc == Encoding::Fixed) { |
| 824 | return static_cast<FieldType>(ctx.read_uint64(ctx.error())); |
| 825 | } else if constexpr (enc == Encoding::Tagged) { |
| 826 | return static_cast<FieldType>(ctx.read_tagged_uint64(ctx.error())); |
| 827 | } |
| 828 | return static_cast<FieldType>(ctx.read_var_uint64(ctx.error())); |
| 829 | } else if constexpr (std::is_same_v<FieldType, int32_t> || |
| 830 | std::is_same_v<FieldType, int>) { |
| 831 | if constexpr (enc == Encoding::Fixed) { |
| 832 | return static_cast<FieldType>(ctx.read_int32(ctx.error())); |
| 833 | } |
| 834 | return static_cast<FieldType>(ctx.read_var_int32(ctx.error())); |
| 835 | } else if constexpr (std::is_same_v<FieldType, int64_t> || |
| 836 | std::is_same_v<FieldType, long long>) { |
| 837 | if constexpr (enc == Encoding::Fixed) { |
| 838 | return static_cast<FieldType>(ctx.read_int64(ctx.error())); |
| 839 | } else if constexpr (enc == Encoding::Tagged) { |
| 840 | return static_cast<FieldType>(ctx.read_tagged_int64(ctx.error())); |
| 841 | } |
| 842 | return static_cast<FieldType>(ctx.read_var_int64(ctx.error())); |
| 843 | } else { |
| 844 | return Serializer<FieldType>::read_data(ctx); |
| 845 | } |
| 846 | } else { |
| 847 | return Serializer<FieldType>::read_data(ctx); |
| 848 | } |
| 849 | } |
| 850 | |
| 851 | template <typename ValueType, typename StructT, size_t Index, int8_t NodeIndex> |
| 852 | void write_configured_value(const ValueType &value, WriteContext &ctx, |
nothing calls this directly
no test coverage detected