     }
 }
 
-static CUDA_HOST_DEVICE double bayesianEstimateOfEmpiricalQuality(const uint32 nObservations, const uint32 nErrors, const double QReported, bool need_rounding)
+static CUDA_HOST_DEVICE double bayesianEstimateOfEmpiricalQuality(const uint64 nObservations, const uint64 nErrors, const double QReported, bool need_rounding)
 {
     constexpr int numBins = (MAX_REASONABLE_Q_SCORE + 1) * int(RESOLUTION_BINS_PER_QUAL);
     double log10Posteriors[numBins];

static CUDA_HOST_DEVICE double calcEmpiricalQuality(const covariate_empirical_value& val, bool need_rounding)
{
    // smoothing is one error and one non-error observation
    const uint32 mismatches = uint32(val.mismatches + 0.5) + SMOOTHING_CONSTANT;
    const uint32 observations = val.observations + SMOOTHING_CONSTANT + SMOOTHING_CONSTANT;

    double empiricalQual = bayesianEstimateOfEmpiricalQuality(observations, mismatches, val.estimated_quality, need_rounding);
    return min(empiricalQual, double(MAX_RECALIBRATED_Q_SCORE));

    return lnToLog10(lgammaf(x));
}

static CUDA_HOST_DEVICE double log10Factorial(const uint64 x)
{
    return log10Gamma(x + 1);
}

static CUDA_HOST_DEVICE double log10BinomialCoefficient(const uint64 n, const uint64 k)
{
    return log10Factorial(n) - log10Factorial(k) - log10Factorial(n - k);
}

static CUDA_HOST_DEVICE double log10BinomialProbability(const uint64 n, const uint64 k, const double log10p)
{
    double log10OneMinusP = log10(1 - pow(10.0, log10p));
    return log10BinomialCoefficient(n, k) + log10p * k + log10OneMinusP* (n - k);
