bench: Make benchmarks compile on MSVC
This commit is contained in:
parent
0e5cbd01b3
commit
1a6be5745f
18
src/bench.h
18
src/bench.h
@ -7,15 +7,31 @@
|
|||||||
#ifndef SECP256K1_BENCH_H
|
#ifndef SECP256K1_BENCH_H
|
||||||
#define SECP256K1_BENCH_H
|
#define SECP256K1_BENCH_H
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "sys/time.h"
|
|
||||||
|
#if (defined(_MSC_VER) && _MSC_VER >= 1900)
|
||||||
|
# include <time.h>
|
||||||
|
#else
|
||||||
|
# include "sys/time.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
static int64_t gettime_i64(void) {
|
static int64_t gettime_i64(void) {
|
||||||
|
#if (defined(_MSC_VER) && _MSC_VER >= 1900)
|
||||||
|
/* C11 way to get wallclock time */
|
||||||
|
struct timespec tv;
|
||||||
|
if (!timespec_get(&tv, TIME_UTC)) {
|
||||||
|
fputs("timespec_get failed!", stderr);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
return (int64_t)tv.tv_nsec / 1000 + (int64_t)tv.tv_sec * 1000000LL;
|
||||||
|
#else
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
gettimeofday(&tv, NULL);
|
gettimeofday(&tv, NULL);
|
||||||
return (int64_t)tv.tv_usec + (int64_t)tv.tv_sec * 1000000LL;
|
return (int64_t)tv.tv_usec + (int64_t)tv.tv_sec * 1000000LL;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#define FP_EXP (6)
|
#define FP_EXP (6)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user