if(value<0) value = max-1; else if(value>=max) value = 0;
while (value<0) value = max+value; while (value>=max) value = value-max;
static void handle_key(int shift, int& value, int max, int amt = 1){	if(shift)		value -= amt;	else		value += amt;	if(value<0)		value = max-1;	else if(value>=max)		value = 0;}