<commit_before>///
/// @file  pi_bsearch.h
///
/// Copyright (C) 2013 <NAME>, <<EMAIL>>
///
/// This file is distributed under the BSD License. See the COPYING
/// file in the top level directory.
///

#ifndef PI_BSEARCH_H
#define PI_BSEARCH_H

#include <algorithm>
#include <iterator>

namespace primecount {

template <class ForwardIterator, typename T>
inline T pi_bsearch(ForwardIterator first, ForwardIterator last, const T& value)
{
  return static_cast<T>(
      std::distance(first, std::upper_bound(first, last, value)));
}

} // namespace primecount

#endif
<commit_msg>Documentation<commit_after>///
/// @file  pi_bsearch.h
///
/// Copyright (C) 2013 <NAME>, <<EMAIL>>
///
/// This file is distributed under the BSD License. See the COPYING
/// file in the top level directory.
///

#ifndef PI_BSEARCH_H
#define PI_BSEARCH_H

#include <algorithm>
#include <iterator>

namespace primecount {

/// Given a std::vector with the first n primes and x <= nth prime
/// calculate the number of primes below x using binary search.
/// Run time: O(log x)
///
template <class ForwardIterator, typename T>
inline T pi_bsearch(ForwardIterator first, ForwardIterator last, const T& x)
{
  return static_cast<T>(
      std::distance(first, std::upper_bound(first, last, x)));
}

} // namespace primecount

#endif

{'fraction_non_alphanumeric': 0.13587786259541984, 'fraction_numerical': 0.0061068702290076335, 'mean_word_length': 3.802197802197802, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5676498', 'n_tokens_mistral': 423, 'n_tokens_neox': 406, 'n_words': 142}