- Random123-1.09 Documentation

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

# Random123/features/compilerfeatures.h

Go to the documentation of this file.

    00001 /*
    00002 Copyright 2010-2011, D. E. Shaw Research.
    00003 All rights reserved.
    00004
    00005 Redistribution and use in source and binary forms, with or without
    00006 modification, are permitted provided that the following conditions are
    00007 met:
    00008
    00009 * Redistributions of source code must retain the above copyright
    00010   notice, this list of conditions, and the following disclaimer.
    00011
    00012 * Redistributions in binary form must reproduce the above copyright
    00013   notice, this list of conditions, and the following disclaimer in the
    00014   documentation and/or other materials provided with the distribution.
    00015
    00016 * Neither the name of D. E. Shaw Research nor the names of its
    00017   contributors may be used to endorse or promote products derived from
    00018   this software without specific prior written permission.
    00019
    00020 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    00021 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    00022 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    00023 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    00024 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    00025 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    00026 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    00027 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    00028 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    00029 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    00030 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    00031 */
    00190 /*
    00191 N.B.  When something is added to the list of features, it should be
    00192 added to each of the *features.h files, AND to examples/ut_features.cpp.
    00193 */
    00194
    00195 /* N.B.  most other compilers (icc, nvcc, open64, llvm) will also define __GNUC__, so order matters. */
    00196 #if defined(__OPENCL_VERSION__) && __OPENCL_VERSION__ > 0
    00197 #include "openclfeatures.h"
    00198 #elif defined(__CUDACC__)
    00199 #include "nvccfeatures.h"
    00200 #elif defined(__ICC)
    00201 #include "iccfeatures.h"
    00202 #elif defined(__xlC__)
    00203 #include "xlcfeatures.h"
    00204 #elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
    00205 #include "sunprofeatures.h"
    00206 #elif defined(__OPEN64__)
    00207 #include "open64features.h"
    00208 #elif defined(__clang__)
    00209 #include "clangfeatures.h"
    00210 #elif defined(__GNUC__)
    00211 #include "gccfeatures.h"
    00212 #elif defined(__PGI)
    00213 #include "pgccfeatures.h"
    00214 #elif defined(_MSC_FULL_VER)
    00215 #include "msvcfeatures.h"
    00216 #else
    00217 #error "Can't identify compiler.  You'll need to add a new xxfeatures.hpp"
    00218 { /* maybe an unbalanced brace will terminate the compilation */
    00219 #endif
    00220
    00221 #ifndef R123_USE_CXX11
    00222 #define R123_USE_CXX11 (__cplusplus >= 201103L)
    00223 #endif
    00224
    00225 #ifndef R123_USE_CXX11_UNRESTRICTED_UNIONS
    00226 #define R123_USE_CXX11_UNRESTRICTED_UNIONS R123_USE_CXX11
    00227 #endif
    00228
    00229 #ifndef R123_USE_CXX11_STATIC_ASSERT
    00230 #define R123_USE_CXX11_STATIC_ASSERT R123_USE_CXX11
    00231 #endif
    00232
    00233 #ifndef R123_USE_CXX11_CONSTEXPR
    00234 #define R123_USE_CXX11_CONSTEXPR R123_USE_CXX11
    00235 #endif
    00236
    00237 #ifndef R123_USE_CXX11_EXPLICIT_CONVERSIONS
    00238 #define R123_USE_CXX11_EXPLICIT_CONVERSIONS R123_USE_CXX11
    00239 #endif
    00240
    00241 #ifndef R123_USE_CXX11_RANDOM
    00242 #define R123_USE_CXX11_RANDOM R123_USE_CXX11
    00243 #endif
    00244
    00245 #ifndef R123_USE_CXX11_TYPE_TRAITS
    00246 #define R123_USE_CXX11_TYPE_TRAITS R123_USE_CXX11
    00247 #endif
    00248
    00249 #ifndef R123_USE_CXX11_LONG_LONG
    00250 #define R123_USE_CXX11_LONG_LONG R123_USE_CXX11
    00251 #endif
    00252
    00253 #ifndef R123_USE_MULHILO64_C99
    00254 #define R123_USE_MULHILO64_C99 0
    00255 #endif
    00256
    00257 #ifndef R123_USE_MULHILO64_MULHI_INTRIN
    00258 #define R123_USE_MULHILO64_MULHI_INTRIN 0
    00259 #endif
    00260
    00261 #ifndef R123_USE_MULHILO32_MULHI_INTRIN
    00262 #define R123_USE_MULHILO32_MULHI_INTRIN 0
    00263 #endif
    00264
    00265 #ifndef R123_STATIC_ASSERT
    00266 #if R123_USE_CXX11_STATIC_ASSERT
    00267 #define R123_STATIC_ASSERT(expr, msg) static_assert(expr, msg)
    00268 #else
    00269     /* if msg always_looked_like_this, we could paste it into the name.  Worth it? */
    00270 #define R123_STATIC_ASSERT(expr, msg) typedef char static_assertion[(!!(expr))*2-1]
    00271 #endif
    00272 #endif
    00273
    00274 #ifndef R123_CONSTEXPR
    00275 #if R123_USE_CXX11_CONSTEXPR
    00276 #define R123_CONSTEXPR constexpr
    00277 #else
    00278 #define R123_CONSTEXPR
    00279 #endif
    00280 #endif
    00281
    00282 #ifndef R123_USE_PHILOX_64BIT
    00283 #define R123_USE_PHILOX_64BIT (R123_USE_MULHILO64_ASM || R123_USE_MULHILO64_MSVC_INTRIN || R123_USE_MULHILO64_CUDA_INTRIN || R123_USE_GNU_UINT128 || R123_USE_MULHILO64_C99 || R123_USE_MULHILO64_OPENCL_INTRIN || R123_USE_MULHILO64_MULHI_INTRIN)
    00284 #endif
    00285
    00286 #ifndef R123_ULONG_LONG
    00287 #if defined(__cplusplus) && !R123_USE_CXX11_LONG_LONG
    00288 /* C++98 doesn't have long long.  It doesn't have uint64_t either, but
    00289    we will have typedef'ed uint64_t to something in the xxxfeatures.h.
    00290    With luck, it won't elicit complaints from -pedantic.  Cross your
    00291    fingers... */
    00292 #define R123_ULONG_LONG uint64_t
    00293 #else
    00294 #define R123_ULONG_LONG unsigned long long
    00295 #endif
    00296 #endif
    00297
    00298 /* UINT64_C should have been #defined by XXXfeatures.h, either by
    00299    #include <stdint.h> or through compiler-dependent hacks */
    00300 #ifndef R123_64BIT
    00301 #define R123_64BIT(x) UINT64_C(x)
    00302 #endif
    00303
    00304 #ifndef R123_THROW
    00305 #define R123_THROW(x)    throw (x)
    00306 #endif
    00307
    00308 /*
    00309  * Windows.h (and perhaps other "well-meaning" code define min and
    00310  * max, so there's a high chance that our definition of min, max
    00311  * methods or use of std::numeric_limits min and max will cause
    00312  * complaints in any program that happened to include Windows.h or
    00313  * suchlike first.  We use the null macro below in our own header
    00314  * files definition or use of min, max to defensively preclude
    00315  * this problem.  It may not be enough; one might need to #define
    00316  * NOMINMAX before including Windows.h or compile with -DNOMINMAX.
    00317  */
    00318 #define R123_NO_MACRO_SUBST
    00319

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines