--- In [email protected], Paul Herring <pauljherr...@...> wrote: > > I'd say no.
Thanks Paul. > I think we need a bit more background to the reason for the question ;) Log data has been collected in a big circular buffer and dumped to file. The circular buffer is implemented using a bank of SDRAM with a wrapping index pointing to the 'end' of the buffer. However the data is dumped from low SDRAM address to high, without the index value. But the data is timestamped, so I can determine where the 'end' of the buffer is by looking for a discontinuity in the timestamps. My algorithm is: 1. count the number of records N up to the timestamp discontinuity 2. process the remaining records up to the end of file 3. rewind the file back to the beginning 4. process N records (which were just counted in step 1) This should result in all the records being processed in timestamp order. But if the circular buffer index is 0 ie. there is no timestamp discontinuity in the file, then step 1 will result in reaching the end of file with N equaling the number of records in the file. So moving on to step 2, we are already at the end of file when we attempt to read the next record, hence my question. It's not difficult to avoid this situation, but I wanted to keep the algorithm as simple as possible. Hope that makes sense.
