From e6a3674150b01d2126b4a653cd10ea1ab6f3b09d Mon Sep 17 00:00:00 2001 From: Walter Doekes Date: Sat, 19 Jan 2013 20:54:07 +0000 Subject: Add builtin roundf() for systems lacking it. (closes issue ASTERISK-16854) Review: https://reviewboard.asterisk.org/r/2276 Reported-by: Ovidiu Sas ........ Merged revisions 379547 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 379548 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@379549 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- main/strcompat.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'main') diff --git a/main/strcompat.c b/main/strcompat.c index dcd84d876..c3b4ff180 100644 --- a/main/strcompat.c +++ b/main/strcompat.c @@ -17,6 +17,8 @@ /*! \file * * \brief Compatibility functions for strsep and strtoq missing on Solaris + * + * .. and lots of other functions too. */ /*** MODULEINFO @@ -568,3 +570,15 @@ char *mkdtemp(char *path) return mktemp_internal(path, 0, MKTEMP_DIR) ? NULL : path; } #endif + +#ifndef HAVE_ROUNDF +#ifndef HAVE_ROUND +float roundf(float x) { + if (x < 0.0) { + return (float)(int)((x) - 0.5); + } else { + return (float)(int)((x) + 0.5); + } +} +#endif +#endif -- cgit v1.2.3