[Intel-gfx] [PATCH v4 04/38] lib: Add a simple prime number generator
Chris Wilson
chris at chris-wilson.co.uk
Thu Dec 22 10:00:35 UTC 2016
On Thu, Dec 22, 2016 at 11:52:45AM +0200, Joonas Lahtinen wrote:
> On to, 2016-12-22 at 08:36 +0000, Chris Wilson wrote:
> > Prime numbers are interesting for testing components that use multiplies
> > and divides, such as testing DRM's struct drm_mm alignment computations.
> >
> > v2: Move to lib/, add selftest
> > v3: Fix initial constants (exclude 0/1 from being primes)
> > v4: More RCU markup to keep 0day/sparse happy
> > v5: Fix RCU unwind on module exit, add to kselftests
> > v6: Tidy computation of bitmap size
> > v7: for_each_prime_number_from()
> > v8: Compose small-primes using BIT() for easier verification
> > v9: Move rcu dance entirely into callers.
> >
> > Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> > Cc: Lukas Wunner <lukas at wunner.de>
>
> <SNIP>
>
> > +static bool expand_to_next_prime(unsigned long x)
> > +{
> > + const struct primes *p;
> > + struct primes *new;
> > + unsigned long sz, y;
> > +
> > + /* Betrand's Theorem states:
>
> "From Bertrand's postulate:"
It has been proven, so it should be referred to as a theorem! :)
Anyway, Wolfram calls it Betrand's postulate, Bertrand-Chebyshev theorem
or Chebyshev's theorem, so pretty ambigious. I've updated the quote to
include the full statement (as well as the simplified version for us)
and a couple of links to wikipedia and Wolfram for easy reference.
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
More information about the dri-devel
mailing list