refactor ring_buffer_idx_t