| 862 | } |
| 863 | |
| 864 | inline Reference GetRoot(const uint8_t *buffer, size_t size) { |
| 865 | // See Finish() below for the serialization counterpart of this. |
| 866 | // The root starts at the end of the buffer, so we parse backwards from there. |
| 867 | auto end = buffer + size; |
| 868 | auto byte_width = *--end; |
| 869 | auto packed_type = *--end; |
| 870 | end -= byte_width; // The root data item. |
| 871 | return Reference(end, byte_width, packed_type); |
| 872 | } |
| 873 | |
| 874 | inline Reference GetRoot(const std::vector<uint8_t> &buffer) { |
| 875 | return GetRoot(flatbuffers::vector_data(buffer), buffer.size()); |
no test coverage detected