aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/imports.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2015-03-22 14:10:47 +0100
committermarha <marha@users.sourceforge.net>2015-03-22 14:10:47 +0100
commit3bc24b271f45f9f33484b8cf53b44f33f7e8a237 (patch)
tree193651a94adb3804e800747e993d07b92688e4d4 /mesalib/src/mesa/main/imports.c
parentc646056120fe14e4c4ccf81bac5d78d61225a8e8 (diff)
parent82c8df11062f72a7d467e26cedbbd8b322ff7a70 (diff)
downloadvcxsrv-3bc24b271f45f9f33484b8cf53b44f33f7e8a237.tar.gz
vcxsrv-3bc24b271f45f9f33484b8cf53b44f33f7e8a237.tar.bz2
vcxsrv-3bc24b271f45f9f33484b8cf53b44f33f7e8a237.zip
Merge remote-tracking branch 'origin/released'
Conflicts: mesalib/src/mapi/glapi/glapi.h mesalib/src/mapi/glapi/glapi_nop.c mesalib/src/mesa/main/bufferobj.c
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