Skip to content

Commit

Permalink
Fix compilation errors on VS2017 for x86
Browse files Browse the repository at this point in the history
MSVC errors without this patch:
tinyexpr.c(161): error C2099: initializer is not a constant
tinyexpr.c(161): warning C4047: 'initializing': 'const void *' differs in levels of indirection from 'int'
tinyexpr.c(167): error C2099: initializer is not a constant
tinyexpr.c(167): warning C4047: 'initializing': 'const void *' differs in levels of indirection from 'int'
  • Loading branch information
dacap committed Jul 24, 2018
1 parent ffb0d41 commit ca50544
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tinyexpr.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ static double ncr(double n, double r) {
return result;
}
static double npr(double n, double r) {return ncr(n, r) * fac(r);}
static double te_ceil(double x) {return ceil(x);}
static double te_floor(double x) {return floor(x);}

static const te_variable functions[] = {
/* must be in alphabetical order */
Expand All @@ -156,13 +158,13 @@ static const te_variable functions[] = {
{"asin", asin, TE_FUNCTION1 | TE_FLAG_PURE, 0},
{"atan", atan, TE_FUNCTION1 | TE_FLAG_PURE, 0},
{"atan2", atan2, TE_FUNCTION2 | TE_FLAG_PURE, 0},
{"ceil", ceil, TE_FUNCTION1 | TE_FLAG_PURE, 0},
{"ceil", te_ceil, TE_FUNCTION1 | TE_FLAG_PURE, 0},
{"cos", cos, TE_FUNCTION1 | TE_FLAG_PURE, 0},
{"cosh", cosh, TE_FUNCTION1 | TE_FLAG_PURE, 0},
{"e", e, TE_FUNCTION0 | TE_FLAG_PURE, 0},
{"exp", exp, TE_FUNCTION1 | TE_FLAG_PURE, 0},
{"fac", fac, TE_FUNCTION1 | TE_FLAG_PURE, 0},
{"floor", floor, TE_FUNCTION1 | TE_FLAG_PURE, 0},
{"floor",te_floor,TE_FUNCTION1 | TE_FLAG_PURE, 0},
{"ln", log, TE_FUNCTION1 | TE_FLAG_PURE, 0},
#ifdef TE_NAT_LOG
{"log", log, TE_FUNCTION1 | TE_FLAG_PURE, 0},
Expand Down

0 comments on commit ca50544

Please sign in to comment.