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
ZacckOsiemo
ZacckOsiemoβ€’6mo ago
Are you talking about circular buffers?
youcef_ali
youcef_aliβ€’6mo ago
I remember in PIC16F assembly there was an instruction RRF and RLF
attachment 0
Camila_99$$
Camila_99$$β€’6mo ago
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
Camila_99$$
Camila_99$$β€’6mo ago
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
youcef_ali
youcef_aliβ€’6mo ago
You can use dynamic arrays or by using, memory allocations, memealloc and realloc
Want results from more Discord servers?
Add your server