2013-11-13 Jan-Benedict Glaw <jbglaw@lug-owl.de>
[official-gcc.git] / gcc / ada / a-coprnu.ads
blob33af3e1919450e68907cbead136e0728b27d3c72
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT LIBRARY COMPONENTS --
4 -- --
5 -- A D A . C O N T A I N E R S . P R I M E _ N U M B E R S --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 2004-2009, Free Software Foundation, Inc. --
10 -- --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
17 -- --
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
19 -- additional permissions described in the GCC Runtime Library Exception, --
20 -- version 3.1, as published by the Free Software Foundation. --
21 -- --
22 -- You should have received a copy of the GNU General Public License and --
23 -- a copy of the GCC Runtime Library Exception along with this program; --
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
25 -- <http://www.gnu.org/licenses/>. --
26 -- --
27 -- This unit was originally developed by Matthew J Heaney. --
28 ------------------------------------------------------------------------------
30 -- This package declares the prime numbers array used to implement hashed
31 -- containers. Bucket arrays are always allocated with a prime-number
32 -- length (computed using To_Prime below), as this produces better scatter
33 -- when hash values are folded.
35 package Ada.Containers.Prime_Numbers is
36 pragma Pure;
38 type Primes_Type is array (Positive range <>) of Hash_Type;
40 Primes : constant Primes_Type :=
41 (53, 97, 193, 389, 769,
42 1543, 3079, 6151, 12289, 24593,
43 49157, 98317, 196613, 393241, 786433,
44 1572869, 3145739, 6291469, 12582917, 25165843,
45 50331653, 100663319, 201326611, 402653189, 805306457,
46 1610612741, 3221225473, 4294967291);
48 function To_Prime (Length : Count_Type) return Hash_Type;
49 -- Returns the smallest value in Primes not less than Length
51 end Ada.Containers.Prime_Numbers;