Created
September 3, 2011 15:09
-
-
Save jj1bdx/1191317 to your computer and use it in GitHub Desktop.
Tiny Mersenne Twister patch for TinyMT-src-1.0 ( see http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/TINYMT/index.html )
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is a fix for 32bit runtime environment (tested on FreeBSD/i386 8.2-RELEASE) | |
(Note: tested on gcc 4.5.4 20110825) | |
--- tinymt/check64.c.FCS 2011-06-20 16:09:18.000000000 +0900 | |
+++ tinymt/check64.c 2011-09-03 23:49:08.000000000 +0900 | |
@@ -27,7 +27,7 @@ | |
tinymt64_t tinymt; | |
tinymt.mat1 = strtoul(argv[1], NULL, 16); | |
tinymt.mat2 = strtoul(argv[2], NULL, 16); | |
- tinymt.tmat = strtoul(argv[3], NULL, 16); | |
+ tinymt.tmat = strtoull(argv[3], NULL, 16); | |
int seed = 1; | |
uint64_t seed_array[5]; | |
if (argc >= 5) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is a workaround for Dynamic Creator code; | |
errno in strtol/strtoll/strtoul/strtoull is NOT set | |
when the functions are successfully executed. | |
--- parse_opt.cpp.FCS 2011-06-20 16:09:18.000000000 +0900 | |
+++ parse_opt.cpp 2011-09-04 00:55:17.000000000 +0900 | |
@@ -56,6 +56,8 @@ | |
opt.max_delta = 10; | |
opt.start = start; | |
opt.all = false; | |
+ // this is a kludge, but default value should be explicitly set | |
+ errno = 0; | |
for (;;) { | |
c = getopt_long(argc, argv, "vas:m:f:c:", longopts, NULL); | |
if (error) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment