// TODO: unify this exponential + binary search with the bytes needed function above
public static double TotalHashCapacity(double bytes, double fpp) {
    double word_bits = 32;
    double bucket_words = 8;
    double hash_bits = 32;
    double result = 1;
    // TODO: unify this exponential + binary search with the bytes needed function above
    while (Fpp(result, bytes) < fpp) {
      result *= 2;
    }
    if (result == 1) return 0;
    double lo = 0;
    while (lo + 1 < result) {
       double mid = lo + (result - lo) / 2;
       double test = Fpp(mid, bytes);
       if (test < fpp)
         lo = mid;
       else if (test == fpp)
         return mid;
       else
         result = mid;
    }
    return lo;
  }
double hash_bits = 32;
double result = 1;
// TODO: unify this exponential + binary search with the bytes needed function above
while (Fpp(result, bytes) < fpp) {
result *= 2;
public static double TotalHashCapacity(double bytes, double fpp) {
double word_bits = 32;
double bucket_words = 8;
double hash_bits = 32;
double result = 1;
// TODO: unify this exponential + binary search with the bytes needed function above
while (Fpp(result, bytes) < fpp) {
result *= 2;
}
if (result == 1) return 0;
double lo = 0;
while (lo + 1 < result) {
double mid = lo + (result - lo) / 2;
double test = Fpp(mid, bytes);
if (test < fpp)
lo = mid;
public static double TotalHashCapacity(double bytes, double fpp) {
double word_bits = 32;
double bucket_words = 8;
double hash_bits = 32;
double result = 1;
// TODO: unify this exponential + binary search with the bytes needed function above
while (Fpp(result, bytes) < fpp) {
result *= 2;
}
if (result == 1) return 0;
double lo = 0;
while (lo + 1 < result) {
double mid = lo + (result - lo) / 2;
double test = Fpp(mid, bytes);
if (test < fpp)
lo = mid;
else if (test == fpp)
return mid;
else
result = mid;
}
return lo;
}