Offline repost #6

huzzah! i took the time to implement a function rarely used not required for a fifo stack implementation of mine. it's called "crosscopy" and moves a memory block from a_s to destination a_d and a block from b_s to b_d simultaneously while a_s and b_d may overlap as well as b_s and a_d but not a_s and also not a_d and b_d. While this is a very special situation, it bears an algorithmic problem that's nowadays either solved by creating a new memory that's used to rearrange them without destroying the original memory. However, I decided to not use any mirroring or excessive XORing and solely work in-place. I find this especially challenging and also really usefull for places where memory is as limited or you can only safely access a certain area without overwriting other stuff. After figuring out a working and not completely optimized algorithm (in terms of code size), I noticed how effective this could work in combination with defragmentating harddrives. I think it's possible to rewrite the algorithm, to feature n blocks of crosscopied memory... If this will work, I can write my own fragmentation-based file system! Hooray! Or atleast I can used this as a base for memory allocation using handles instead of direct addresses. For a realtime allocation... there are definitely better variants out there. I can already imagine one... However, this stuff has quite motivated me today after this dilemma of always fucking up my system. Weird that this stuff also makes me happy after a bad day.

No comments: