aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/minikql/primes.cpp
blob: 334b882844f6b33860b64581bb642597c343c3a9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include "primes.h"

#include <util/generic/array_size.h>
#include <util/generic/algorithm.h>

namespace NKikimr {

static const unsigned long PRIMES[] = {
#include "primes.gen"
};

unsigned long FindNearestPrime(unsigned long num) {
    if (num <= *PRIMES) {
        return *PRIMES;
    }

    return *LowerBound(PRIMES, PRIMES + Y_ARRAY_SIZE(PRIMES) - 1, num);
}

}