mirror of
https://github.com/bolero-MURAKAMI/Sprout
synced 2024-11-12 21:09:01 +00:00
workaround for clang3.2: cstdint constant macros missing
This commit is contained in:
parent
4d70a437ce
commit
99547d3fe7
3 changed files with 88 additions and 49 deletions
39
sprout/cstdint.hpp
Normal file
39
sprout/cstdint.hpp
Normal file
|
@ -0,0 +1,39 @@
|
|||
#ifndef SPROUT_CSTDINT_HPP
|
||||
#define SPROUT_CSTDINT_HPP
|
||||
|
||||
#include <climits>
|
||||
#include <cstdint>
|
||||
#include <sprout/config.hpp>
|
||||
|
||||
//
|
||||
// SPROUT_INT[N]_C
|
||||
// SPROUT_UINT[N]_C
|
||||
//
|
||||
#if defined(__clang__) && (__clang_major__ == 3 && __clang_minor__ == 2) && !defined(__STDC_CONSTANT_MACROS)
|
||||
# define SPROUT_INT8_C(n) n
|
||||
# define SPROUT_UINT8_C(n) n
|
||||
# define SPROUT_INT16_C(n) n
|
||||
# define SPROUT_UINT16_C(n) n
|
||||
# if LONG_MAX == LLONG_MAX
|
||||
# define SPROUT_INT32_C(n) n
|
||||
# define SPROUT_UINT32_C(n) n ## U
|
||||
# define SPROUT_INT64_C(n) n ## UL
|
||||
# define SPROUT_UINT64_C(n) n ## UL
|
||||
# else
|
||||
# define SPROUT_INT32_C(n) n ## L
|
||||
# define SPROUT_UINT32_C(n) n ## UL
|
||||
# define SPROUT_INT64_C(n) n ## ULL
|
||||
# define SPROUT_UINT64_C(n) n ## ULL
|
||||
# endif
|
||||
#else
|
||||
# define SPROUT_INT8_C(n) INT8_C(n)
|
||||
# define SPROUT_UINT8_C(n) UINT8_C(n)
|
||||
# define SPROUT_INT16_C(n) INT16_C(n)
|
||||
# define SPROUT_UINT16_C(n) UINT16_C(n)
|
||||
# define SPROUT_INT32_C(n) INT32_C(n)
|
||||
# define SPROUT_UINT32_C(n) UINT32_C(n)
|
||||
# define SPROUT_INT64_C(n) INT64_C(n)
|
||||
# define SPROUT_UINT64_C(n) UINT64_C(n)
|
||||
#endif
|
||||
|
||||
#endif // #ifndef SPROUT_CSTDINT_HPP
|
|
@ -2,9 +2,9 @@
|
|||
#define SPROUT_MATH_FACTORIAL_HPP
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/cstdint.hpp>
|
||||
#include <sprout/array/array.hpp>
|
||||
#include <sprout/type_traits/is_int.hpp>
|
||||
#include <sprout/type_traits/is_uint.hpp>
|
||||
|
@ -86,51 +86,51 @@ namespace sprout {
|
|||
}}
|
||||
# define SPROUT_FACTORIAL_TABLE_DEF_INT_8 \
|
||||
table_type{{ \
|
||||
INT64_C(1), \
|
||||
INT64_C(1), \
|
||||
INT64_C(2), \
|
||||
INT64_C(6), \
|
||||
INT64_C(24), \
|
||||
INT64_C(120), \
|
||||
INT64_C(720), \
|
||||
INT64_C(5040), \
|
||||
INT64_C(40320), \
|
||||
INT64_C(362880), \
|
||||
INT64_C(3628800), \
|
||||
INT64_C(39916800), \
|
||||
INT64_C(479001600), \
|
||||
INT64_C(6227020800), \
|
||||
INT64_C(87178291200), \
|
||||
INT64_C(1307674368000), \
|
||||
INT64_C(20922789888000), \
|
||||
INT64_C(355687428096000), \
|
||||
INT64_C(6402373705728000), \
|
||||
INT64_C(121645100408832000), \
|
||||
INT64_C(2432902008176640000) \
|
||||
SPROUT_INT64_C(1), \
|
||||
SPROUT_INT64_C(1), \
|
||||
SPROUT_INT64_C(2), \
|
||||
SPROUT_INT64_C(6), \
|
||||
SPROUT_INT64_C(24), \
|
||||
SPROUT_INT64_C(120), \
|
||||
SPROUT_INT64_C(720), \
|
||||
SPROUT_INT64_C(5040), \
|
||||
SPROUT_INT64_C(40320), \
|
||||
SPROUT_INT64_C(362880), \
|
||||
SPROUT_INT64_C(3628800), \
|
||||
SPROUT_INT64_C(39916800), \
|
||||
SPROUT_INT64_C(479001600), \
|
||||
SPROUT_INT64_C(6227020800), \
|
||||
SPROUT_INT64_C(87178291200), \
|
||||
SPROUT_INT64_C(1307674368000), \
|
||||
SPROUT_INT64_C(20922789888000), \
|
||||
SPROUT_INT64_C(355687428096000), \
|
||||
SPROUT_INT64_C(6402373705728000), \
|
||||
SPROUT_INT64_C(121645100408832000), \
|
||||
SPROUT_INT64_C(2432902008176640000) \
|
||||
}}
|
||||
# define SPROUT_FACTORIAL_TABLE_DEF_UINT_8 \
|
||||
table_type{{ \
|
||||
UINT64_C(1), \
|
||||
UINT64_C(1), \
|
||||
UINT64_C(2), \
|
||||
UINT64_C(6), \
|
||||
UINT64_C(24), \
|
||||
UINT64_C(120), \
|
||||
UINT64_C(720), \
|
||||
UINT64_C(5040), \
|
||||
UINT64_C(40320), \
|
||||
UINT64_C(362880), \
|
||||
UINT64_C(3628800), \
|
||||
UINT64_C(39916800), \
|
||||
UINT64_C(479001600), \
|
||||
UINT64_C(6227020800), \
|
||||
UINT64_C(87178291200), \
|
||||
UINT64_C(1307674368000), \
|
||||
UINT64_C(20922789888000), \
|
||||
UINT64_C(355687428096000), \
|
||||
UINT64_C(6402373705728000), \
|
||||
UINT64_C(121645100408832000), \
|
||||
UINT64_C(2432902008176640000) \
|
||||
SPROUT_UINT64_C(1), \
|
||||
SPROUT_UINT64_C(1), \
|
||||
SPROUT_UINT64_C(2), \
|
||||
SPROUT_UINT64_C(6), \
|
||||
SPROUT_UINT64_C(24), \
|
||||
SPROUT_UINT64_C(120), \
|
||||
SPROUT_UINT64_C(720), \
|
||||
SPROUT_UINT64_C(5040), \
|
||||
SPROUT_UINT64_C(40320), \
|
||||
SPROUT_UINT64_C(362880), \
|
||||
SPROUT_UINT64_C(3628800), \
|
||||
SPROUT_UINT64_C(39916800), \
|
||||
SPROUT_UINT64_C(479001600), \
|
||||
SPROUT_UINT64_C(6227020800), \
|
||||
SPROUT_UINT64_C(87178291200), \
|
||||
SPROUT_UINT64_C(1307674368000), \
|
||||
SPROUT_UINT64_C(20922789888000), \
|
||||
SPROUT_UINT64_C(355687428096000), \
|
||||
SPROUT_UINT64_C(6402373705728000), \
|
||||
SPROUT_UINT64_C(121645100408832000), \
|
||||
SPROUT_UINT64_C(2432902008176640000) \
|
||||
}}
|
||||
# define SPROUT_FACTORIAL_TABLE_DEF_FLOAT \
|
||||
table_type{{ \
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
#define SPROUT_RANDOM_MERSENNE_TWISTER_HPP
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <ios>
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/cstdint.hpp>
|
||||
#include <sprout/random/random_result.hpp>
|
||||
#include <sprout/array/array.hpp>
|
||||
#include <sprout/detail/integer/integer_mask.hpp>
|
||||
|
@ -586,15 +586,15 @@ namespace sprout {
|
|||
312,
|
||||
156,
|
||||
31,
|
||||
UINT64_C(0xb5026f5aa96619e9),
|
||||
SPROUT_UINT64_C(0xb5026f5aa96619e9),
|
||||
29,
|
||||
UINT64_C(0x5555555555555555),
|
||||
SPROUT_UINT64_C(0x5555555555555555),
|
||||
17,
|
||||
UINT64_C(0x71d67fffeda60000),
|
||||
SPROUT_UINT64_C(0x71d67fffeda60000),
|
||||
37,
|
||||
UINT64_C(0xfff7eee000000000),
|
||||
SPROUT_UINT64_C(0xfff7eee000000000),
|
||||
43,
|
||||
UINT64_C(6364136223846793005)
|
||||
SPROUT_UINT64_C(6364136223846793005)
|
||||
> mt19937_64;
|
||||
} // namespace random
|
||||
|
||||
|
|
Loading…
Reference in a new issue