Use clamp() instead of min()/max().
Use size_t instead of int in some more places.
Clarify comment in generate_config.cc.