| 394 | } |
| 395 | |
| 396 | txID fxNewNameX(txMachine* the, txString theString) |
| 397 | { |
| 398 | txU1* string; |
| 399 | txU4 sum; |
| 400 | txU4 modulo; |
| 401 | txSlot* result; |
| 402 | |
| 403 | string = (txU1*)theString; |
| 404 | sum = 0; |
| 405 | while (c_read8(string) != 0) { |
| 406 | sum = (sum << 1) + c_read8(string++); |
| 407 | } |
| 408 | sum &= 0x7FFFFFFF; |
| 409 | modulo = sum % the->nameModulo; |
| 410 | result = the->nameTable[modulo]; |
| 411 | while (result != C_NULL) { |
| 412 | if (result->value.key.sum == sum) { |
| 413 | if (c_strcmp(result->value.key.string, theString) == 0) { |
| 414 | txID id = mxGetKeySlotID(result); |
| 415 | if (id >= the->keyOffset) |
| 416 | result->flag |= XS_DONT_DELETE_FLAG; |
| 417 | return id; |
| 418 | } |
| 419 | } |
| 420 | result = result->next; |
| 421 | } |
| 422 | result = fxFindKey(the); |
| 423 | result->next = the->nameTable[modulo]; |
| 424 | result->flag = XS_INTERNAL_FLAG | XS_DONT_DELETE_FLAG | XS_DONT_ENUM_FLAG; |
| 425 | result->kind = XS_KEY_X_KIND; |
| 426 | result->value.key.string = theString; |
| 427 | result->value.key.sum = sum; |
| 428 | the->nameTable[modulo] = result; |
| 429 | return result->ID; |
| 430 | } |
| 431 | |
| 432 | txSlot* fxAt(txMachine* the, txSlot* slot) |
| 433 | { |
no test coverage detected