Fast spectral fitting of hard X-ray bremsstrahlung from truncated power-law electron spectra