| 235 | } |
| 236 | |
| 237 | static bool CompareTablesByStringKey(const Offset<Table> *_a, |
| 238 | const Offset<Table> *_b, |
| 239 | const FieldDef &key) { |
| 240 | const voffset_t offset = key.value.offset; |
| 241 | // Indirect offset pointer to table pointer. |
| 242 | auto a = reinterpret_cast<const uint8_t *>(_a) + ReadScalar<uoffset_t>(_a); |
| 243 | auto b = reinterpret_cast<const uint8_t *>(_b) + ReadScalar<uoffset_t>(_b); |
| 244 | // Fetch field address from table. |
| 245 | a = reinterpret_cast<const Table *>(a)->GetAddressOf(offset); |
| 246 | b = reinterpret_cast<const Table *>(b)->GetAddressOf(offset); |
| 247 | if (a && b) { |
| 248 | // Indirect offset pointer to string pointer. |
| 249 | a += ReadScalar<uoffset_t>(a); |
| 250 | b += ReadScalar<uoffset_t>(b); |
| 251 | return *reinterpret_cast<const String *>(a) < |
| 252 | *reinterpret_cast<const String *>(b); |
| 253 | } else { |
| 254 | return a ? true : false; |
| 255 | } |
| 256 | } |
| 257 | |
| 258 | static void SwapSerializedTables(Offset<Table> *a, Offset<Table> *b) { |
| 259 | // These are serialized offsets, so are relative where they are |
no test coverage detected