fix unsigned short id

This commit is contained in:
REAndroid 2023-01-01 11:01:52 -05:00
parent 2bcbf76f2f
commit b503df9890

View File

@ -36,20 +36,25 @@ public class EntryBlockArray extends OffsetBlockArray<EntryBlock> implements JSO
return !iterator(true).hasNext(); return !iterator(true).hasNext();
} }
public void setEntry(short entryId, EntryBlock entryBlock){ public void setEntry(short entryId, EntryBlock entryBlock){
setItem(entryId, entryBlock); setItem(0xffff & entryId, entryBlock);
} }
public EntryBlock getOrCreate(short entryId){ public EntryBlock getOrCreate(short entryId){
EntryBlock entryBlock=get(entryId); int id = 0xffff & entryId;
EntryBlock entryBlock=get(id);
if(entryBlock!=null){ if(entryBlock!=null){
return entryBlock; return entryBlock;
} }
int count=entryId+1; int count=id+1;
ensureSize(count); ensureSize(count);
refreshCount(); refreshCount();
return get(entryId); return get(id);
}
public EntryBlock get(short entryId){
int index = 0xffff & entryId;
return super.get(index);
} }
public EntryBlock getEntry(short entryId){ public EntryBlock getEntry(short entryId){
return get(entryId); return get(0xffff & entryId);
} }
@Override @Override
public EntryBlock newInstance() { public EntryBlock newInstance() {