From: ehofman Date: Fri, 23 Jan 2004 18:27:55 +0000 (+0000) Subject: Rather define our own truncf implementation for BSD alikes X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=74d163b51bb1152a09130c03feff67c1ab625277;p=flightgear.git Rather define our own truncf implementation for BSD alikes --- diff --git a/src/Cockpit/panel.cxx b/src/Cockpit/panel.cxx index 63185884c..7a26ead05 100644 --- a/src/Cockpit/panel.cxx +++ b/src/Cockpit/panel.cxx @@ -53,6 +53,12 @@ // my hardware/driver requires many more. #define POFF_UNITS 4 +#ifdef __FreeBSD__ // no truncf on FreeBSD +inline float truncf (float d) { + return (d < 0) ? -floorf(-d) : floorf(d); +} +#endif + //////////////////////////////////////////////////////////////////////// // Local functions. @@ -1119,7 +1125,7 @@ FGTextLayer::Chunk::getValue () const break; case DOUBLE_VALUE: double d = _offs + _node->getFloatValue() * _mult; - if (_trunc) d = floorf(d); + if (_trunc) d = truncf(d); sprintf(_buf, _fmt.c_str(), d); break; }