aboutsummaryrefslogtreecommitdiffstats
path: root/gen/bits/intconf.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-10-16 23:00:22 +0200
committerMattias Andrée <maandree@operamail.com>2015-10-16 23:00:22 +0200
commit693595d7f1fc6da0956aa4882ad53d04b1ffd762 (patch)
tree343c9eca45df0c4a46df6dbe00ecf3034aed1083 /gen/bits/intconf.c
parentthe compiler determines how wchar is implement + intconf.h contains the signess of char (diff)
downloadslibc-693595d7f1fc6da0956aa4882ad53d04b1ffd762.tar.gz
slibc-693595d7f1fc6da0956aa4882ad53d04b1ffd762.tar.bz2
slibc-693595d7f1fc6da0956aa4882ad53d04b1ffd762.tar.xz
m
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--gen/bits/intconf.c13
1 files changed, 6 insertions, 7 deletions
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 <stdio.h>
#include <string.h>
-#include <stddef.h>
#include <time.h>
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;