Is there an instruction to "rotate" the elements of an array
Hello everyone, ππ» quick question Do you know if there is an instruction to "rotate" the elements of an array, meaning to shift the elements one position to the left or right and, if possible, insert the element that goes out on the other side???
5 Replies
Are you talking about circular buffers?
I remember in PIC16F assembly there was an instruction RRF and RLF
Yes, itβs similar to a circular buffer, but Iβm working with a small array on an ATtiny. Iβm looking for a more memory-efficient way to rotate elements without the overhead of a full circular buffer implementation
That's a good point! Unfortunately, the ATtiny microcontrollers I'm using don't have direct RRF and RLF instructions, so I'm trying to find an alternative solution
You can use dynamic arrays or by using, memory allocations, memealloc and realloc