MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / das_table_find

Function das_table_find

src/misc/daScriptC.cpp:1288–1300  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1286// before dereferencing. Strict-alignment targets fault on misaligned loads.
1287
1288void * das_table_find ( das_context * context, das_table * tab, int key_base_type, const void * key, uint32_t value_size ) {
1289 void * result = nullptr;
1290 auto * t = (Table *)tab;
1291 DAS_TABLE_DISPATCH(key_base_type, {
1292 KEY_TYPE k;
1293 memcpy(&k, key, sizeof(KEY_TYPE));
1294 uint64_t h = hash_function(*(Context *)context, k);
1295 TableHash<KEY_TYPE> hh((Context *)context, value_size);
1296 int64_t idx = hh.find(*t, k, h);
1297 if ( idx >= 0 ) result = t->data + uint64_t(idx) * uint64_t(value_size);
1298 })
1299 return result;
1300}
1301
1302void * das_table_insert ( das_context * context, das_table * tab, int key_base_type, const void * key, uint32_t value_size ) {
1303 void * result = nullptr;

Callers 3

test_capi_i64.cppFile · 0.85
mainFunction · 0.85

Calls 2

hash_functionFunction · 0.85
findMethod · 0.45

Tested by

no test coverage detected