From 864310e3da059371ac7345ee3bf900a6055f26b4 Mon Sep 17 00:00:00 2001 From: zhiayang Date: Thu, 2 Feb 2017 04:20:33 +0800 Subject: oh boy, basic osx/unix support --- src/check_expr.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/check_expr.c') diff --git a/src/check_expr.c b/src/check_expr.c index f8d966319..ca4a0baed 100644 --- a/src/check_expr.c +++ b/src/check_expr.c @@ -225,6 +225,9 @@ i64 check_distance_between_types(Checker *c, Operand *operand, Type *type) { return -1; } +#ifndef _MAX +#define _MAX(x, y) ((x) > (y) ? (x) : (y)) +#endif bool check_is_assignable_to_with_score(Checker *c, Operand *operand, Type *type, i64 *score_) { i64 score = 0; @@ -232,7 +235,8 @@ bool check_is_assignable_to_with_score(Checker *c, Operand *operand, Type *type, bool ok = distance >= 0; if (ok) { // TODO(bill): A decent score function - score = max(1000000 - distance*distance, 0); + // score = max(1000000 - distance*distance, 0); + score = _MAX(1000000 - distance*distance, 0); } if (score_) *score_ = score; return ok; -- cgit v1.2.3