From e5c4c1415bff4ae5e08a7d1ec7cdcce3ba589eb2 Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Tue, 2 Apr 2024 15:58:55 +0200 Subject: Add replacement for potentially missing trunc() (#944) - add configure + CMake checks to define HAVE_TRUNC in config.h - src/Fl_Timeout.cxx: add local replacement function --- src/Fl_Timeout.cxx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/Fl_Timeout.cxx b/src/Fl_Timeout.cxx index bc3d0cb84..921c40c75 100644 --- a/src/Fl_Timeout.cxx +++ b/src/Fl_Timeout.cxx @@ -2,7 +2,7 @@ // Timeout support functions for the Fast Light Tool Kit (FLTK). // // Author: Albrecht Schlosser -// Copyright 2021-2023 by Bill Spitzak and others. +// Copyright 2021-2024 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -15,12 +15,18 @@ // https://www.fltk.org/bugs.php // +#include + #include "Fl_Timeout.h" #include "Fl_System_Driver.H" #include #include // for trunc() +#if !HAVE_TRUNC +static inline double trunc(double x) { x >= 0 ? floor(x) : ceil(x); } +#endif // !HAVE_TRUNC + /** \file Fl_Timeout.cxx */ -- cgit v1.2.3