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