ring: allow non power-of-2 sizes