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 */ 00179 /* 00180 N.B. When something is added to the list of features, it should be 00181 added to each of the *features.h files, AND to examples/ut_features.cpp. 00182 */ 00183 00184 /* N.B. most other compilers (icc, nvcc, open64, llvm) will also define __GNUC__, so order matters. */ 00185 #if defined(__OPENCL_VERSION__) && __OPENCL_VERSION__ > 0 00186 #include "openclfeatures.h" 00187 #elif defined(__CUDACC__) 00188 #include "nvccfeatures.h" 00189 #elif defined(__ICC) 00190 #include "iccfeatures.h" 00191 #elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) 00192 #include "sunprofeatures.h" 00193 #elif defined(__OPEN64__) 00194 #include "open64features.h" 00195 #elif defined(__llvm__) 00196 #include "llvmfeatures.h" 00197 #elif defined(__GNUC__) 00198 #include "gccfeatures.h" 00199 #elif defined(_MSC_FULL_VER) 00200 #include "msvcfeatures.h" 00201 #else 00202 #error "Can't identify compiler. You'll need to add a new xxfeatures.hpp" 00203 { /* maybe an unbalanced brace will terminate the compilation */ 00204 #endif 00205 00206 #ifndef R123_STATIC_ASSERT 00207 #if R123_USE_CXX0X 00208 #define R123_STATIC_ASSERT(expr, msg) static_assert(expr, msg) 00209 #else 00210 /* if msg always_looked_like_this, we could paste it into the name. Worth it? */ 00211 #define R123_STATIC_ASSERT(expr, msg) typedef char static_assertion[(!!(expr))*2-1] 00212 #endif 00213 #endif 00214 00215 #ifndef R123_USE_PHILOX_64BIT 00216 #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) 00217 #endif 00218 00219 #ifndef R123_ULONG_LONG 00220 #if defined(__cplusplus) && !R123_USE_CXX0X 00221 /* C++98 doesn't have long long. It doesn't have uint64_t either, but 00222 we will have typedef'ed uint64_t to something in the xxxfeatures.h. 00223 With luck, it won't elicit complaints from -pedantic. Cross your 00224 fingers... */ 00225 #define R123_ULONG_LONG uint64_t 00226 #else 00227 #define R123_ULONG_LONG unsigned long long 00228 #endif 00229 #endif 00230 00231 /* UINT64_C should have been #defined by XXXfeatures.h, either by 00232 #include <stdint.h> or through compiler-dependent hacks */ 00233 #ifndef R123_64BIT 00234 #define R123_64BIT(x) UINT64_C(x) 00235 #endif 00236 00237 #ifndef R123_THROW 00238 #define R123_THROW(x) throw (x) 00239 #endif 00240 00241 #ifndef R123_USE_U01_DOUBLE 00242 #define R123_USE_U01_DOUBLE 1 00243 #endif 00244 00245 /* 00246 * Windows.h (and perhaps other "well-meaning" code define min and 00247 * max, so there's a high chance that our definition of min, max 00248 * methods or use of std::numeric_limits min and max will cause 00249 * complaints in any program that happened to include Windows.h or 00250 * suchlike first. We use the null macro below in our own header 00251 * files definition or use of min, max to defensively preclude 00252 * this problem. It may not be enough; one might need to #define 00253 * NOMINMAX before including Windows.h or compile with -DNOMINMAX. 00254 */ 00255 #define R123_NO_MACRO_SUBST 00256