Amanieu / intrusive-rs

Intrusive collections for Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why is `parent_color` usize in RBTreeLink?

Restioson opened this issue · comments

Why does this have to be a usize? Couldn't it be a u8?

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.

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 ❤️