From b4c5c52944a44ba863a22a53035ff561af7318ca Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Mon, 3 Jun 2013 17:55:29 +0800 Subject: [PATCH] util/ansi-print.cc: Use fallback implementation for lround on MSVC Unfortuately Visual Studio (still) does not support the C99 function lround, so provide a fallback implementation for it. --- util/ansi-print.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/util/ansi-print.cc b/util/ansi-print.cc index 873bee8..e166c91 100644 --- a/util/ansi-print.cc +++ b/util/ansi-print.cc @@ -41,6 +41,17 @@ #include /* for isatty() */ #endif +#ifdef _MSC_VER +static inline long int +lround (double x) +{ + if (x >= 0) + return floor (x + 0.5); + else + return ceil (x - 0.5); +} +#endif + #define MIN(a,b) ((a) < (b) ? (a) : (b)) #define CELL_W 8 -- 2.7.4