| 324 | } |
| 325 | |
| 326 | txID fxNewName(txMachine* the, txSlot* theSlot) |
| 327 | { |
| 328 | txU1* string; |
| 329 | txU4 sum; |
| 330 | txU4 modulo; |
| 331 | txSlot* result; |
| 332 | |
| 333 | string = (txU1*)theSlot->value.string; |
| 334 | sum = 0; |
| 335 | while(*string != 0) { |
| 336 | sum = (sum << 1) + *string++; |
| 337 | } |
| 338 | sum &= 0x7FFFFFFF; |
| 339 | modulo = sum % the->nameModulo; |
| 340 | result = the->nameTable[modulo]; |
| 341 | while (result != C_NULL) { |
| 342 | if (result->value.key.sum == sum) { |
| 343 | if (c_strcmp(result->value.key.string, theSlot->value.string) == 0) |
| 344 | return mxGetKeySlotID(result); |
| 345 | } |
| 346 | result = result->next; |
| 347 | } |
| 348 | result = fxFindKey(the); |
| 349 | result->next = the->nameTable[modulo]; |
| 350 | result->flag = XS_INTERNAL_FLAG | XS_DONT_ENUM_FLAG; |
| 351 | result->kind = XS_KEY_KIND; |
| 352 | result->value.key.string = theSlot->value.string; |
| 353 | result->value.key.sum = sum; |
| 354 | the->nameTable[modulo] = result; |
| 355 | return result->ID; |
| 356 | } |
| 357 | |
| 358 | txID fxNewNameC(txMachine* the, txString theString) |
| 359 | { |
no test coverage detected