Better integer casting

cf openstreetmap-carto#992