3 ms·
What other representations of "start/current/end" do you know of? Both versions just use 3 pointers. I am not aware of specific instructions on any architecture
by celeritascelery 3y ago
What other representations of "start/current/end" do you know of? Both versions just use 3 pointers. I am not aware of specific instructions on any architecture that would impact the direction the heap grows. They essentially boil down to adds, subtracts, and and's.
- JonChesterfield 3y agoStart as void*, current and/or end as size_t offsets from start is common. The opposite way round works too, use a void* for end and current and/or end as offsets from that. 64 bit pointer and two 32 bit offsets might appeal on x64. Without working through the arithmetic now I'd expect storing (size-current)=remaining instead of current to work well for the out of space check.