-
Notifications
You must be signed in to change notification settings - Fork 547
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document behaviour of IntegerUtils.shiftLeftFromSpecifiedPosition
#516
Comments
shiftLeftFromSpecifiedPosition() is to move the bytes after the removed position to a previouse position one by one. For example: the four bytes of the key is : 8,11, 13, 16 , now we remove the position 2 key(13), then move the afterward key value (16) to key value(13) poistion ,that is the final keys would be : 8, 11, 16,16; |
If the 4 bytes not stored as an int to save the java array object memory footprint,and stored as byte[4] keys, the logic would be as follow :
|
@richardstartin if you still wanna this, would be appreciate you could give a concise description to document this behavior in your native language or pr it. |
I found this method after discovering (from an OOME in tests) that within the ART module
int
s are modified by unpacking to abyte[]
, performing the modification, and then packing back to anint
again.IntegerUtils.shiftLeftFromSpecifiedPosition
looks a little odd to me:The following test case, which covers the combinations of
position
andcount
for which the method doesn't throw, passes:The method is only used in node removal, which is unlikely to be widely used. The pattern above looks a little suspicious to me, so the behaviour in node removal is either quite subtle or perhaps wrong:
If the method's implementation is correct, I think explaining the logic for modifying the key when removing nodes would be helpful.
The text was updated successfully, but these errors were encountered: