What you're doing is totally fine, but here's how I might do it:
struct palette {
u16 *items;
u8 first_i;
};
void scrollPalette(struct palette *p, bool scroll_dir)
{
if (scroll_dir) {
p->first_i = (p->first_i + 1) % 16;
} else {
p->first_i = p->first_i == 0 ? 15 : p->first_i - 1;
}
}
Then you need to access and display the palette differently, for example:
u16 palleteGet(struct pallete *p, u8 n) {
return p->items[(p->first_i + n) % 16];
}