diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2017-02-01 20:31:57 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-02-01 20:31:57 +0000 |
| commit | c6133587d1bdf7ae723beb8c3a3b27b472bf2d7a (patch) | |
| tree | fd080deab099e74ec5f50841c6a8b5b5b8b5c3c4 /src/check_expr.c | |
| parent | 4e7082a68dd5261c3c36eccf92a62a0ce84995a8 (diff) | |
| parent | 5516e80ab775d1100beca7847e10520eae4b151c (diff) | |
Merge pull request #16 from zhiayang/master
Basic, but sketchy, but somewhat usable, non-windows support
Diffstat (limited to 'src/check_expr.c')
| -rw-r--r-- | src/check_expr.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/check_expr.c b/src/check_expr.c index c8b1c3175..6b09c3a82 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; |