From 693595d7f1fc6da0956aa4882ad53d04b1ffd762 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 16 Oct 2015 23:00:22 +0200 Subject: m MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- gen/bits/intconf.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'gen/bits/intconf.c') diff --git a/gen/bits/intconf.c b/gen/bits/intconf.c index 8d1311b..7e48fce 100644 --- a/gen/bits/intconf.c +++ b/gen/bits/intconf.c @@ -17,13 +17,12 @@ */ #include #include -#include #include volatile char nul = 0; -volatile wchar_t wnul = 0; +volatile typeof(L'\0') wnul = 0; @@ -39,14 +38,14 @@ volatile wchar_t wnul = 0; #define FAST_TEST(VAR) \ n = 0, *VAR##p = 0; \ if (clock_gettime(CLOCK_THREAD_CPUTIME_ID, &start)) \ - return perror(NULL), -1; \ + return perror(""), -1; \ for (;;) \ { \ for (m = 1000; m--;) \ VAR = 50, VAR += 50, VAR -= 50, VAR *= 50, VAR /= 50, VAR <<= 1, VAR >>= 1, *VAR##p |= 1; \ n++; \ if (clock_gettime(CLOCK_THREAD_CPUTIME_ID, &end)) \ - return perror(NULL), -1; \ + return perror(""), -1; \ if (end.tv_sec > start.tv_sec + 2) \ break; \ if (end.tv_sec > start.tv_sec + 1) \ @@ -61,19 +60,19 @@ volatile wchar_t wnul = 0; fprintf(stderr, "int%zu_t:%s %i000 op:s in %lli.%09lli s = %lf op:s/s\n", \ 8 * sizeof(VAR), 8 * sizeof(VAR) < 10 ? " " : "", 8 * n, \ time_elapsed / 1000000000LL, time_elapsed % 1000000000LL, adjn * 8000.); \ - if (adjn > bestn) \ + if ((!best) || (adjn > bestn)) \ bestn = adjn, best = 8 * sizeof(VAR); \ last = this #define TEST(VAR) (this = 8 * (int)sizeof(VAR), ((this >= bits) && (this > last))) -#ifdef __GNUC__ +#if defined(__GNUC__) __attribute__((optimize("-O0"))) #endif static int fast(int bits) { int last = 0, this = 0, best = 0, n, m; - float bestn; + float bestn = 0; float adjn; struct timespec start, end; long long int time_elapsed; -- cgit v1.2.3-70-g09d2