port: Add fminf and fmaxf implementations for ulibc

André Hentschel nerv at dawncrow.de
Wed Sep 7 15:00:17 CDT 2011


fixes http://bugs.winehq.org/show_bug.cgi?id=28247
---
 configure.ac          |    2 ++
 include/wine/port.h   |   10 ++++++++++
 libs/port/Makefile.in |    1 +
 libs/port/float.c     |   36 ++++++++++++++++++++++++++++++++++++
 4 files changed, 49 insertions(+), 0 deletions(-)
 create mode 100644 libs/port/float.c

diff --git a/configure.ac b/configure.ac
index 40ea431..f38bfe3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1914,6 +1914,8 @@ AC_CHECK_FUNCS(\
 	epoll_create \
 	ffs \
 	finite \
+	fmaxf \
+	fminf \    
 	fnmatch \
 	fork \
 	fpclass \
diff --git a/include/wine/port.h b/include/wine/port.h
index 8281653..6a7790d 100644
--- a/include/wine/port.h
+++ b/include/wine/port.h
@@ -239,6 +239,14 @@ extern int getopt_long_only (int ___argc, char *const *___argv,
 int ffs( int x );
 #endif
 
+#ifndef HAVE_FMAXF
+float fmaxf(float a, float b);
+#endif
+
+#ifndef HAVE_FMINF
+float fminf(float a, float b);
+#endif
+
 #ifndef HAVE_FUTIMES
 struct timeval;
 int futimes(int fd, const struct timeval *tv);
@@ -437,6 +445,8 @@ extern unsigned char interlocked_cmpxchg128( __int64 *dest, __int64 xchg_high,
 #define __WINE_NOT_PORTABLE(func) func##_is_not_portable func##_is_not_portable
 
 #define ffs                     __WINE_NOT_PORTABLE(ffs)
+#define fmaxf                   __WINE_NOT_PORTABLE(fmaxf)
+#define fminf                   __WINE_NOT_PORTABLE(fminf)
 #define fstatvfs                __WINE_NOT_PORTABLE(fstatvfs)
 #define futimes                 __WINE_NOT_PORTABLE(futimes)
 #define getopt_long             __WINE_NOT_PORTABLE(getopt_long)
diff --git a/libs/port/Makefile.in b/libs/port/Makefile.in
index f2f6db0..bbde175 100644
--- a/libs/port/Makefile.in
+++ b/libs/port/Makefile.in
@@ -4,6 +4,7 @@ MODULE    = libwine_port.a
 
 C_SRCS = \
 	ffs.c \
+	float.c \
 	fstatvfs.c \
 	futimes.c \
 	getopt.c \
diff --git a/libs/port/float.c b/libs/port/float.c
new file mode 100644
index 0000000..3ed2cec
--- /dev/null
+++ b/libs/port/float.c
@@ -0,0 +1,36 @@
+/*
+ * float functions
+ *
+ * Copyright 2011 André Hentschel
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "config.h"
+#include "wine/port.h"
+
+#ifndef HAVE_FMAXF
+float fmaxf(float a, float b)
+{
+    return (a > b) ? a : b;
+}
+#endif
+
+#ifndef HAVE_FMINF
+float fminf(float a, float b)
+{
+    return (a < b) ? a : b;
+}
+#endif
-- 

Best Regards, André Hentschel



More information about the wine-patches mailing list