surely std::min was the intent

Change-Id: Ic643d047e475cc3be0ea7e972c51e17babc1aa1e