From: Alex Converse Date: Thu, 7 Apr 2016 22:16:30 +0000 (-0700) Subject: Add roundf and lroundf replacements for VS < 2013. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d1327aec1bceaa7c998dd2eb47ab646f6c5db33d;p=libvpx Add roundf and lroundf replacements for VS < 2013. Change-Id: I25678279ab44672acf680bf04d9c551156e2904b --- diff --git a/vpx_ports/msvc.h b/vpx_ports/msvc.h index cab77405f..d6b8503b0 100644 --- a/vpx_ports/msvc.h +++ b/vpx_ports/msvc.h @@ -26,6 +26,20 @@ static INLINE double round(double x) { else return floor(x + 0.5); } + +static INLINE float roundf(float x) { + if (x < 0) + return (float)ceil(x - 0.5f); + else + return (float)floor(x + 0.5f); +} + +static INLINE long lroundf(float x) { + if (x < 0) + return (long)(x - 0.5f); + else + return (long)(x + 0.5f); +} #endif // _MSC_VER < 1800 #endif // _MSC_VER