Why is `parent_color` usize in RBTreeLink?
Restioson opened this issue · comments
Restioson commented
Why does this have to be a usize? Couldn't it be a u8?
Amanieu d'Antras commented
It holds the parent pointer, and puts the color in the lowest bit of the address. This is OK since the address is at least aligned by 2.
Restioson commented
Ah ok, I was wondering since it wasn't obvious that it also held a pointer to the parent. Closing.
By the way, thanks for such a high quality and speedy crate! I was able to achieve (in a simulation) 3GiB/s throughput of physical (mocked) memory allocation using the RBTree for buddy memory allocation. If you want, you can see the benchmarks here https://github.com/Restioson/buddy-allocator-workshop. Great work ❤️