On Thu, 2024-04-04 at 09:31 +0900, Masahiko Sawada wrote: > IIUC, with your suggestion, sift_{up|down} needs to update the > heap_index field as well. Does it mean that the caller needs to pass > the address of heap_index down to sift_{up|down}?
I'm not sure quite how binaryheap should be changed. Bringing the heap implementation into reorderbuffer.c would obviously work, but that would be more code. Another option might be to make the API of binaryheap look a little more like simplehash, where some #defines control optional behavior and can tell the implementation where to find fields in the structure. Perhaps it's not worth the effort though, if performance is already good enough? Regards, Jeff Davis