I have a 6 deep circular buffer. At some point in time one of the array entries will have in it 0xFE. This will mark and identify the 0th point. I would like to do simple math (xor) to look for changes on consecutive entries before and after this point as well as identify where in time each was within the constraints of the buffer itself. It seems to me the easiest thing to do is to arrange the original array to a new array as below, but for the life of me this seems pretty difficult. Does anyone have a simple solution to this?
Original Array
[*p-4, *p-3, *p-2, *p-1, 0xFE, *p+1]
New Array
[0xFE, *p+1, *p-4, *p-3, *p-2, *p-1]
Thank you