This could in principle be made truly constant-time. Signed-off-by: Daira Hopwood <daira@jacaranda.org>