Shifting rows in a double array

I have an big array of unsigned bytes
uint8_t myAry[48][60]

Every hour I want to shift everything up one row and add new values to the last row. Here's an example with a smaller array 3 x 4 array

  1. 34, 55, 93, 90
  2. 12, 22, 54, 49
  3. 87, 21, 88, 96

Now I want row 0 to drop off, row 1 to shift to row 0, row 2 to shift to row 1 and row 2 gets new data. For example

  1. 12, 22, 54, 49
  2. 87, 21, 88, 96
  3. 88, 49, 36, 29

Is there an efficient way to do this with shifting bits or something? I could write some loops to do it, but I'm hoping there's a better way.

On what board? 48 * 60 = 2880 bytes, which is more than you have on a Uno anyway.

A memmove should do the trick, anyway.

Why go through all the trouble of moving things? Define a couple of pointers and work it like a circular array.

Delta_G:
Why go through all the trouble of moving things? Define a couple of pointers and work it like a circular array.

Could you give me an example of what you mean? I don't know what a circular array is.

BTW, I'm using a Mega 2560.

Could you give me an example of what you mean?

The serial receive buffer is an example.
It has a head and tail pointer.
New characters are added to the tail by the receive interrupt, and taken off the head by the "read" method.

Delta_G:
Why go through all the trouble of moving things? Define a couple of pointers and work it like a circular array.

I'd do it with index values rather than pointers.

I'd do it with index values rather than pointers.

Since C allows you to do stuff like:

int array [10];
int* pArray = array;

void setup ()
{
  int index = 5;
  array [index] = 17;
  int y = index [array];
  int x = index [pArray];
}

, it can be very hard to tell the difference sometimes!

Agreed that there are lots of ways to make it work, but the approach I'd rather use is to access the array using an explicit index value for each dimension, which can then be range-checked and wrapped as necessary. IMO this makes for an implementation which can easily be understood and seen to be correct.

PeterH:
Agreed that there are lots of ways to make it work, but the approach I'd rather use is to access the array using an explicit index value for each dimension, which can then be range-checked and wrapped as necessary. IMO this makes for an implementation which can easily be understood and seen to be correct.

I understand the concept of pointers, but I have a hard time using them. I really have to put on my thinking cap so I don't get confused. I think I can figure this out using an index, that seems pretty straight forward.

What do you mean by "wrapped"?

"wrapped" as in "wrap-around", as in don't go below the lowest-addressable item or above the highest.