| 117 | namespace { |
| 118 | |
| 119 | Status IntFromFlatbuffer(const flatbuf::Int* int_data, std::shared_ptr<DataType>* out) { |
| 120 | if (int_data->bitWidth() > 64) { |
| 121 | return Status::NotImplemented("Integers with more than 64 bits not implemented"); |
| 122 | } |
| 123 | if (int_data->bitWidth() < 8) { |
| 124 | return Status::NotImplemented("Integers with less than 8 bits not implemented"); |
| 125 | } |
| 126 | |
| 127 | switch (int_data->bitWidth()) { |
| 128 | case 8: |
| 129 | *out = int_data->is_signed() ? int8() : uint8(); |
| 130 | break; |
| 131 | case 16: |
| 132 | *out = int_data->is_signed() ? int16() : uint16(); |
| 133 | break; |
| 134 | case 32: |
| 135 | *out = int_data->is_signed() ? int32() : uint32(); |
| 136 | break; |
| 137 | case 64: |
| 138 | *out = int_data->is_signed() ? int64() : uint64(); |
| 139 | break; |
| 140 | default: |
| 141 | return Status::NotImplemented("Integers not in cstdint are not implemented"); |
| 142 | } |
| 143 | return Status::OK(); |
| 144 | } |
| 145 | |
| 146 | Status FloatFromFlatbuffer(const flatbuf::FloatingPoint* float_data, |
| 147 | std::shared_ptr<DataType>* out) { |
no test coverage detected