aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/imports.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2015-03-22 13:30:59 +0100
committermarha <marha@users.sourceforge.net>2015-03-22 13:30:59 +0100
commit82c8df11062f72a7d467e26cedbbd8b322ff7a70 (patch)
tree7e7a3e408d09d3e50ff0d2f9befeb5b7ab5617a5 /mesalib/src/mesa/main/imports.c
parent8574eba804031f6b19713f0b02952280730bf62e (diff)
downloadvcxsrv-82c8df11062f72a7d467e26cedbbd8b322ff7a70.tar.gz
vcxsrv-82c8df11062f72a7d467e26cedbbd8b322ff7a70.tar.bz2
vcxsrv-82c8df11062f72a7d467e26cedbbd8b322ff7a70.zip
randrproto fontconfig libX11 libXdmcp libxcb mesa xkbcomp xserver git update 22 Mar 2015
xserver commit 0a78b599b34cc8b5fe6fe82f90e90234e8ab7a56 libxcb commit a90be9955d2c5a635f791d44db1154633b9d3322 libX11 commit 5a499ca7b064bf7e6a4fcc169f22862dce0c60c5 libXdmcp commit 0c09444d276fbf46a0e8b427a4f6a325d0625742 xkbcomp commit fc3e6ddb2c8e922ea80f2dc5cbc1df2102e30d99 randrproto commit b1ba68df8a5fc113a387123ec2f312195e28e47f fontconfig commit 69ff6b6e260584e383c38b1b7034ddcbb23d214f mesa commit 397b491173f0d2df4deb44d21c170bf16840d507
Diffstat (limited to 'mesalib/src/mesa/main/imports.c')
-rw-r--r--mesalib/src/mesa/main/imports.c43
1 files changed, 3 insertions, 40 deletions
diff --git a/mesalib/src/mesa/main/imports.c b/mesalib/src/mesa/main/imports.c
index a7ffe2296..68c731657 100644
--- a/mesalib/src/mesa/main/imports.c
+++ b/mesalib/src/mesa/main/imports.c
@@ -45,6 +45,7 @@
#include <stdio.h>
#include <stdarg.h>
#include "c99_math.h"
+#include "util/rounding.h" /* for _mesa_roundeven */
#include "imports.h"
#include "context.h"
#include "mtypes.h"
@@ -307,26 +308,6 @@ _mesa_bitcount_64(uint64_t n)
#endif
-/* Using C99 rounding functions for roundToEven() implementation is
- * difficult, because round(), rint, and nearbyint() are affected by
- * fesetenv(), which the application may have done for its own
- * purposes. Mesa's IROUND macro is close to what we want, but it
- * rounds away from 0 on n + 0.5.
- */
-int
-_mesa_round_to_even(float val)
-{
- int rounded = IROUND(val);
-
- if (val - floor(val) == 0.5) {
- if (rounded % 2 != 0)
- rounded += val > 0 ? -1 : 1;
- }
-
- return rounded;
-}
-
-
/**
* Convert a 4-byte float to a 2-byte half float.
*
@@ -388,7 +369,7 @@ _mesa_float_to_half(float val)
* or normal.
*/
e = 0;
- m = _mesa_round_to_even((1 << 24) * fabsf(fi.f));
+ m = (int) _mesa_roundevenf((1 << 24) * fabsf(fi.f));
}
else if (new_exp > 15) {
/* map this value to infinity */
@@ -402,7 +383,7 @@ _mesa_float_to_half(float val)
* either normal or infinite.
*/
e = new_exp + 15;
- m = _mesa_round_to_even(flt_m / (float) (1 << 13));
+ m = (int) _mesa_roundevenf(flt_m / (float) (1 << 13));
}
}
@@ -481,24 +462,6 @@ _mesa_half_to_float(GLhalfARB val)
/** \name String */
/*@{*/
-/**
- * Implemented using malloc() and strcpy.
- * Note that NULL is handled accordingly.
- */
-char *
-_mesa_strdup( const char *s )
-{
- if (s) {
- size_t l = strlen(s);
- char *s2 = malloc(l + 1);
- if (s2)
- strcpy(s2, s);
- return s2;
- }
- else {
- return NULL;
- }
-}
/** Compute simple checksum/hash for a string */
unsigned int