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 --- include/asterisk/autoconfig.h.in | 3 +++ include/asterisk/compat.h | 8 ++++++++ 2 files changed, 11 insertions(+) (limited to 'include/asterisk') diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in index 52e96c08a..6c7a785bb 100644 --- a/include/asterisk/autoconfig.h.in +++ b/include/asterisk/autoconfig.h.in @@ -702,6 +702,9 @@ /* Define to 1 if you have the `round' function. */ #undef HAVE_ROUND +/* Define to 1 if you have the `roundf' function. */ +#undef HAVE_ROUNDF + /* Define to 1 if you have the `roundl' function. */ #undef HAVE_ROUNDL diff --git a/include/asterisk/compat.h b/include/asterisk/compat.h index afb851d2e..e5147cbde 100644 --- a/include/asterisk/compat.h +++ b/include/asterisk/compat.h @@ -216,4 +216,12 @@ typedef unsigned long long uint64_t; #define MY_GLOB_FLAGS (GLOB_NOMAGIC | GLOB_BRACE) #endif +#ifndef HAVE_ROUNDF +#ifdef HAVE_ROUND +#define roundf(x) ((float)round(x)) +#else +float roundf(float x); +#endif +#endif + #endif -- cgit v1.2.3