move code out of line so that GCC doesn't inline it at -O3