]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/include/parallel/types.h
3 // Copyright (C) 2007, 2008 Free Software Foundation, Inc.
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the terms
7 // of the GNU General Public License as published by the Free Software
8 // Foundation; either version 2, or (at your option) any later
11 // This library is distributed in the hope that it will be useful, but
12 // WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this library; see the file COPYING. If not, write to
18 // the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
19 // MA 02111-1307, USA.
21 // As a special exception, you may use this file as part of a free
22 // software library without restriction. Specifically, if other files
23 // instantiate templates or use macros or inline functions from this
24 // file, or you compile this file and link it with other files to
25 // produce an executable, this file does not by itself cause the
26 // resulting executable to be covered by the GNU General Public
27 // License. This exception does not however invalidate any other
28 // reasons why the executable file might be covered by the GNU General
31 /** @file parallel/types.h
32 * @brief Basic types and typedefs.
33 * This file is a GNU parallel extension to the Standard C++ Library.
36 // Written by Johannes Singler and Felix Putze.
38 #ifndef _GLIBCXX_PARALLEL_TYPES_H
39 #define _GLIBCXX_PARALLEL_TYPES_H 1
42 #include <tr1/cstdint>
44 namespace __gnu_parallel
48 /// @brief Run-time equivalents for the compile-time tags.
54 /// Parallel unbalanced (equal-sized chunks).
57 /// Parallel balanced (work-stealing).
60 /// Parallel with OpenMP dynamic load-balancing.
63 /// Parallel with OpenMP static load-balancing.
64 parallel_omp_loop_static
,
66 /// Parallel with OpenMP taskqueue construct.
71 is_parallel(const parallelism __p
) { return __p
!= sequential
; }
74 using std::tr1::int16_t;
75 using std::tr1::uint16_t;
77 using std::tr1::int32_t;
78 using std::tr1::uint32_t;
80 using std::tr1::int64_t;
81 using std::tr1::uint64_t;
84 * @brief Unsigned integer to index elements.
85 * The total number of elements for each algorithm must fit into this type.
87 typedef uint64_t sequence_index_t
;
90 * @brief Unsigned integer to index a thread number.
91 * The maximum thread number (for each processor) must fit into this type.
93 typedef uint16_t thread_index_t
;
95 // XXX atomics interface?
97 * @brief Longest compare-and-swappable integer type on this platform.
99 typedef int64_t lcas_t
;
101 // XXX numeric_limits::digits?
103 * @brief Number of bits of ::lcas_t.
105 static const int lcas_t_bits
= sizeof(lcas_t
) * 8;
108 * @brief ::lcas_t with the right half of bits set to 1.
110 static const lcas_t lcas_t_mask
= ((lcas_t(1) << (lcas_t_bits
/ 2)) - 1);
113 #endif /* _GLIBCXX_TYPES_H */