1 // ==========================================================================
2 // $Source: /var/lib/cvs/Givaro/src/kernel/zpz/givprimes16.h,v $
3 // Copyright(c)'1994-2009 by The Givaro group
4 // This file is part of Givaro.
5 // Givaro is governed by the CeCILL-B license under French law
6 // and abiding by the rules of distribution of free software.
7 // see the COPYRIGHT file for more details.
8 // Authors: T. Gautier
9 // Time-stamp: <02 Oct 07 16:43:17 Jean-Guillaume.Dumas@imag.fr>
10 // ==========================================================================
11 
12 /*! @file givprimes16.h
13  * @ingroup zpz
14  * @brief  set of primes less than 2^16
15  */
16 
17 #ifndef __GIVARO_primes16_H
18 #define __GIVARO_primes16_H
19 
20 #include <stddef.h>
21 namespace Givaro {
22   //! class Primes16
23 class Primes16  {
24 public:
25 
26   // -- Returns the number of primes of this ctxt
count()27 static size_t count() { return _size; }
28 
ith(size_t i)29 static size_t ith(size_t i) {
30 //    JGD 02.10.2007 : dependent of system/givconfig.h
31 //    GIVARO_ASSERT( (i>=0)&&(i<(int)_size), "[Primes16::ith] index out of bounds");
32     return _primes[i];
33 }
34 
35 private:
36 static const size_t _size;
37 static const size_t  _primes[];
38 };
39 } // namespace Givaro
40 
41 #endif // __GIVARO_primes16_H
42 /* -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
43 // vim:sts=4:sw=4:ts=4:et:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
44