Prevent rehash when value is replaced in table.
This commit is contained in:
@@ -437,14 +437,17 @@ public class LuaTable extends LuaValue {
|
|||||||
if ( value.isnil() )
|
if ( value.isnil() )
|
||||||
hashRemove(key);
|
hashRemove(key);
|
||||||
else {
|
else {
|
||||||
if ( checkLoadFactor() )
|
if ( hashKeys.length == 0 ) {
|
||||||
rehash();
|
hashKeys = new LuaValue[ MIN_HASH_CAPACITY ];
|
||||||
|
hashValues = new LuaValue[ MIN_HASH_CAPACITY ];
|
||||||
|
}
|
||||||
int slot = hashFindSlot( key );
|
int slot = hashFindSlot( key );
|
||||||
if ( hashFillSlot( slot, value ) )
|
if ( hashFillSlot( slot, value ) )
|
||||||
return;
|
return;
|
||||||
hashKeys[slot] = key;
|
hashKeys[slot] = key;
|
||||||
hashValues[slot] = value;
|
hashValues[slot] = value;
|
||||||
|
if ( checkLoadFactor() )
|
||||||
|
rehash();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user