MCPcopy Create free account
hub / github.com/catboost/catboost / CompareTablesByStringKey

Function CompareTablesByStringKey

contrib/libs/flatbuffers/src/idl_parser.cpp:237–256  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

235}
236
237static 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
258static void SwapSerializedTables(Offset<Table> *a, Offset<Table> *b) {
259 // These are serialized offsets, so are relative where they are

Callers 1

ParseVectorMethod · 0.85

Calls 1

GetAddressOfMethod · 0.80

Tested by

no test coverage detected