#include "p_config.h"
#include "p_compiler.h"
#include "p_debug.h"
+#include "p_format.h"
#include "p_pointer.h"
#include <math.h>
#include <stdarg.h>
#define CALLOC_STRUCT(T) (struct T *) CALLOC(1, sizeof(struct T))
-#define GETENV( X ) debug_get_option( X, NULL )
-
/**
* Return memory on given byte alignment
#define MIN2( A, B ) ( (A)<(B) ? (A) : (B) )
#define MAX2( A, B ) ( (A)>(B) ? (A) : (B) )
+#ifndef Elements
#define Elements(x) (sizeof(x)/sizeof((x)[0]))
+#endif
#define Offset(TYPE, MEMBER) ((unsigned)&(((TYPE *)NULL)->MEMBER))
/**
-#if defined(__MSC__) && defined(__WIN32__)
+#if defined(PIPE_CC_MSVC) && defined(PIPE_ARCH_X86)
static INLINE unsigned ffs( unsigned u )
{
unsigned i;
}
-#if defined(__GNUC__) && defined(__i386__)
+#if defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86)
static INLINE int iround(float f)
{
int r;
__asm__ ("fistpl %0" : "=m" (r) : "t" (f) : "st");
return r;
}
-#elif defined(__MSC__) && defined(__WIN32__)
+#elif defined(PIPE_CC_MSVC) && defined(PIPE_ARCH_X86)
static INLINE int iround(float f)
{
int r;
/* util/p_util.c
*/
-extern void pipe_copy_rect(ubyte * dst, unsigned cpp, unsigned dst_pitch,
- unsigned dst_x, unsigned dst_y, unsigned width,
- unsigned height, const ubyte * src,
- int src_pitch, unsigned src_x, int src_y);
-
-
+extern void pipe_copy_rect(ubyte * dst, const struct pipe_format_block *block,
+ unsigned dst_stride, unsigned dst_x, unsigned dst_y,
+ unsigned width, unsigned height, const ubyte * src,
+ int src_stride, unsigned src_x, int src_y);
-#ifdef WIN32
+extern void
+pipe_fill_rect(ubyte * dst, const struct pipe_format_block *block,
+ unsigned dst_stride, unsigned dst_x, unsigned dst_y,
+ unsigned width, unsigned height, uint32_t value);
-#if !defined(_INC_MATH) || !defined(__cplusplus)
+#if defined(_MSC_VER)
+#if _MSC_VER < 1400 && !defined(__cplusplus) || defined(PIPE_SUBSYSTEM_WINDOWS_CE)
+
static INLINE float cosf( float f )
{
return (float) cos( (double) f );
static INLINE float logf( float f )
{
- return (float) cos( (double) f );
+ return (float) log( (double) f );
}
-#endif /* _INC_MATH */
+
+#else
+/* Work-around an extra semi-colon in VS 2005 logf definition */
+#ifdef logf
+#undef logf
+#define logf(x) ((float)log((double)(x)))
+#endif /* logf */
#endif
+#endif /* _MSC_VER */
#ifdef __cplusplus