random123

Counter-based Random Number Generators
git clone git://git.meso-star.com/random123.git
Log | Files | Refs | README | LICENSE

msvcfeatures.h (5106B)


      1 /*
      2 Copyright 2010-2011, D. E. Shaw Research.
      3 All rights reserved.
      4 
      5 Redistribution and use in source and binary forms, with or without
      6 modification, are permitted provided that the following conditions are
      7 met:
      8 
      9 * Redistributions of source code must retain the above copyright
     10   notice, this list of conditions, and the following disclaimer.
     11 
     12 * Redistributions in binary form must reproduce the above copyright
     13   notice, this list of conditions, and the following disclaimer in the
     14   documentation and/or other materials provided with the distribution.
     15 
     16 * Neither the name of D. E. Shaw Research nor the names of its
     17   contributors may be used to endorse or promote products derived from
     18   this software without specific prior written permission.
     19 
     20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     21 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     22 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     23 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     24 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     25 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     26 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     27 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     28 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     29 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     30 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     31 */
     32 #ifndef __msvcfeatures_dot_hpp
     33 #define __msvcfeatures_dot_hpp
     34 
     35 //#if _MSVC_FULL_VER <= 15
     36 //#error "We've only tested MSVC_FULL_VER==15."
     37 //#endif
     38 
     39 #if !defined(_M_IX86) && !defined(_M_X64)
     40 #  error "This code has only been tested on x86 platforms."
     41 { // maybe an unbalanced brace will terminate the compilation
     42 // You are invited to try Random123 on other architectures, by changing
     43 // the conditions that reach this error, but you should consider it a
     44 // porting exercise and expect to encounter bugs and deficiencies.
     45 // Please let the authors know of any successes (or failures).
     46 #endif
     47 
     48 #ifndef R123_STATIC_INLINE
     49 #define R123_STATIC_INLINE static __inline
     50 #endif
     51 
     52 #ifndef R123_FORCE_INLINE
     53 #define R123_FORCE_INLINE(decl) _forceinline decl
     54 #endif
     55 
     56 #ifndef R123_CUDA_DEVICE
     57 #define R123_CUDA_DEVICE
     58 #endif
     59 
     60 #ifndef R123_ASSERT
     61 #include <assert.h>
     62 #define R123_ASSERT(x) assert(x)
     63 #endif
     64 
     65 #ifndef R123_BUILTIN_EXPECT
     66 #define R123_BUILTIN_EXPECT(expr,likely) expr
     67 #endif
     68 
     69 // The basic idiom is:
     70 // #ifndef R123_SOMETHING
     71 // #if some condition
     72 // #define R123_SOMETHING 1
     73 // #else
     74 // #define R123_SOMETHING 0
     75 // #endif
     76 // #endif
     77 // This idiom allows an external user to override any decision
     78 // in this file with a command-line -DR123_SOMETHING=1 or -DR123_SOMETHINE=0
     79 
     80 // An alternative idiom is:
     81 // #ifndef R123_SOMETHING
     82 // #define R123_SOMETHING (some boolean expression)
     83 // #endif
     84 // where the boolean expression might contain previously-defined R123_SOMETHING_ELSE
     85 // pp-symbols.
     86 
     87 #ifndef R123_USE_AES_NI
     88 #if defined(_M_X64)
     89 #define R123_USE_AES_NI 1
     90 #else
     91 #define R123_USE_AES_NI 0
     92 #endif
     93 #endif
     94 
     95 #ifndef R123_USE_SSE4_2
     96 #if defined(_M_X64) || _MSC_VER > 1899
     97 #define R123_USE_SSE4_2 1
     98 #else
     99 #define R123_USE_SSE4_2 0
    100 #endif
    101 #endif
    102 
    103 #ifndef R123_USE_SSE4_1
    104 #if defined(_M_X64) || _MSC_VER > 1899
    105 #define R123_USE_SSE4_1 1
    106 #else
    107 #define R123_USE_SSE4_1 0
    108 #endif
    109 #endif
    110 
    111 #ifndef R123_USE_SSE
    112 #define R123_USE_SSE 1
    113 #endif
    114 
    115 #ifndef R123_USE_AES_OPENSSL
    116 #define R123_USE_AES_OPENSSL 0
    117 #endif
    118 
    119 #ifndef R123_USE_GNU_UINT128
    120 #define R123_USE_GNU_UINT128 0
    121 #endif
    122 
    123 #ifndef R123_USE_ASM_GNU
    124 #define R123_USE_ASM_GNU 0
    125 #endif
    126 
    127 #ifndef R123_USE_CPUID_MSVC
    128 #define R123_USE_CPUID_MSVC 1
    129 #endif
    130 
    131 #ifndef R123_USE_X86INTRIN_H
    132 #define R123_USE_X86INTRIN_H 0
    133 #endif
    134 
    135 #ifndef R123_USE_IA32INTRIN_H
    136 #define R123_USE_IA32INTRIN_H 0
    137 #endif
    138 
    139 #ifndef R123_USE_XMMINTRIN_H
    140 #define R123_USE_XMMINTRIN_H 0
    141 #endif
    142 
    143 #ifndef R123_USE_EMMINTRIN_H
    144 #define R123_USE_EMMINTRIN_H 1
    145 #endif
    146 
    147 #ifndef R123_USE_SMMINTRIN_H
    148 #define R123_USE_SMMINTRIN_H 1
    149 #endif
    150 
    151 #ifndef R123_USE_WMMINTRIN_H
    152 #define R123_USE_WMMINTRIN_H 1
    153 #endif
    154 
    155 #ifndef R123_USE_INTRIN_H
    156 #define R123_USE_INTRIN_H 1
    157 #endif
    158 
    159 #ifndef R123_USE_MULHILO16_ASM
    160 #define R123_USE_MULHILO16_ASM 0
    161 #endif
    162 
    163 #ifndef R123_USE_MULHILO32_ASM
    164 #define R123_USE_MULHILO32_ASM 0
    165 #endif
    166 
    167 #ifndef R123_USE_MULHILO64_ASM
    168 #define R123_USE_MULHILO64_ASM 0
    169 #endif
    170 
    171 #ifndef R123_USE_MULHILO64_MSVC_INTRIN
    172 #if defined(_M_X64)
    173 #define R123_USE_MULHILO64_MSVC_INTRIN 1
    174 #else
    175 #define R123_USE_MULHILO64_MSVC_INTRIN 0
    176 #endif
    177 #endif
    178 
    179 #ifndef R123_USE_MULHILO64_CUDA_INTRIN
    180 #define R123_USE_MULHILO64_CUDA_INTRIN 0
    181 #endif
    182 
    183 #ifndef R123_USE_MULHILO64_OPENCL_INTRIN
    184 #define R123_USE_MULHILO64_OPENCL_INTRIN 0
    185 #endif
    186 
    187 #ifndef __STDC_CONSTANT_MACROS
    188 #define __STDC_CONSTANT_MACROS
    189 #endif
    190 #include <stdint.h>
    191 #ifndef UINT64_C
    192 #error UINT64_C not defined.  You must define __STDC_CONSTANT_MACROS before you #include <stdint.h>
    193 #endif
    194 
    195 #pragma warning(disable:4244)
    196 #pragma warning(disable:4996)
    197 
    198 // If you add something, it must go in all the other XXfeatures.hpp
    199 // and in ../ut_features.cpp
    200 #endif