We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
hi, n e bod know how i can refrag the data in memory?
thx
ow btw, i have the 51 compiler.
You don't need to "refragment" a block of memory, just to send the contents in smaller parts.
Just set a pointer to the start of the big block. Process n bytes. Step pointer forward n bytes. Process n bytes. Step pointer forward n bytes. Repeat until done. Note that the last processed block may have less than n bytes if your big memory block isn't an even multiple of the transfer size.
Only one thing to notice: If your program is allowed to change the contents of the large block during the transfer, then you will not be able to send a "snapshot" contents of the large block. On the other hand - the only possible way to send a snapshot is to forbid updates to the large block while the transfer is active, having enough memory to duplicate the block before you start the transfer or keeping a "change list" and dynamically patch outgoing messages based on previous contents stored in the change list.