mirror of
https://github.com/brl/mutter.git
synced 2024-12-26 12:52:14 +00:00
cogl: Remove unused utils
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3431>
This commit is contained in:
parent
c3c144f991
commit
85e4d08475
@ -35,26 +35,6 @@
|
||||
#include "cogl/cogl-util.h"
|
||||
#include "cogl/cogl-private.h"
|
||||
|
||||
/*
|
||||
* cogl_util_next_p2:
|
||||
* @a: Value to get the next power of two
|
||||
*
|
||||
* Calculates the next power of two greater than or equal to @a.
|
||||
*
|
||||
* Return value: @a if @a is already a power of two, otherwise returns
|
||||
* the next nearest power of two.
|
||||
*/
|
||||
COGL_EXPORT int
|
||||
_cogl_util_next_p2 (int a)
|
||||
{
|
||||
int rval = 1;
|
||||
|
||||
while (rval < a)
|
||||
rval <<= 1;
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
||||
unsigned int
|
||||
_cogl_util_one_at_a_time_mix (unsigned int hash)
|
||||
{
|
||||
|
@ -39,31 +39,6 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
_cogl_util_next_p2 (int a);
|
||||
|
||||
/* The signbit macro is defined by ISO C99 so it should be available,
|
||||
however if it's not we can fallback to an evil hack */
|
||||
#ifdef signbit
|
||||
#define cogl_util_float_signbit(x) signbit(x)
|
||||
#else
|
||||
/* This trick was stolen from here:
|
||||
http://lists.boost.org/Archives/boost/2006/08/108731.php
|
||||
|
||||
It xors the integer reinterpretations of -1.0f and 1.0f. In theory
|
||||
they should only differ by the signbit so that gives a mask for the
|
||||
sign which we can just test against the value */
|
||||
static inline gboolean
|
||||
cogl_util_float_signbit (float x)
|
||||
{
|
||||
static const union { float f; uint32_t i; } negative_one = { -1.0f };
|
||||
static const union { float f; uint32_t i; } positive_one = { +1.0f };
|
||||
union { float f; uint32_t i; } value = { x };
|
||||
|
||||
return !!((negative_one.i ^ positive_one.i) & value.i);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* This is a replacement for the nearbyint function which always
|
||||
rounds to the nearest integer. nearbyint is apparently a C99
|
||||
function so it might not always be available but also it seems in
|
||||
@ -72,13 +47,6 @@ cogl_util_float_signbit (float x)
|
||||
negative numbers. */
|
||||
#define COGL_UTIL_NEARBYINT(x) ((int) ((x) < 0.0f ? (x) - 0.5f : (x) + 0.5f))
|
||||
|
||||
/* Returns whether the given integer is a power of two */
|
||||
static inline gboolean
|
||||
_cogl_util_is_pot (unsigned int num)
|
||||
{
|
||||
/* Make sure there is only one bit set */
|
||||
return (num & (num - 1)) == 0;
|
||||
}
|
||||
|
||||
/* Split Bob Jenkins' One-at-a-Time hash
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user