Comment Comment by exDM69 > Aw. Why not?Because the global allocator API is defined as free(pointer address) and this used free(buffer handle).It would require a reverse lookup structure from address to buffer handle, e.g. red-black tree. Maintaining it would no longer be O(1).> the fact that the number of bits is constant doesn't make this O(1), it just makes it O(n) where n := 64O(n) when n is constant is equal to O(1).But lzcnt uses a fixed number of clock cycles so it's not really O(n) either. parent exDM69 2 years ago
Because the global allocator API is defined as free(pointer address) and this used free(buffer handle).
It would require a reverse lookup structure from address to buffer handle, e.g. red-black tree. Maintaining it would no longer be O(1).
> the fact that the number of bits is constant doesn't make this O(1), it just makes it O(n) where n := 64
O(n) when n is constant is equal to O(1).
But lzcnt uses a fixed number of clock cycles so it's not really O(n) either.