ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

imports.h
Go to the documentation of this file.
00001 /*
00002  * Mesa 3-D graphics library
00003  * Version:  7.1
00004  *
00005  * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
00006  *
00007  * Permission is hereby granted, free of charge, to any person obtaining a
00008  * copy of this software and associated documentation files (the "Software"),
00009  * to deal in the Software without restriction, including without limitation
00010  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
00011  * and/or sell copies of the Software, and to permit persons to whom the
00012  * Software is furnished to do so, subject to the following conditions:
00013  *
00014  * The above copyright notice and this permission notice shall be included
00015  * in all copies or substantial portions of the Software.
00016  *
00017  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00018  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00019  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
00020  * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
00021  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00022  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00023  */
00024 
00025 
00035 #ifndef IMPORTS_H
00036 #define IMPORTS_H
00037 
00038 
00039 /* XXX some of the stuff in glheader.h should be moved into this file.
00040  */
00041 #include "glheader.h"
00042 #include <GL/internal/glcore.h>
00043 
00044 
00045 #ifdef __cplusplus
00046 extern "C" {
00047 #endif
00048 
00049 
00050 /**********************************************************************/
00053 
00054 #ifndef NULL
00055 #define NULL 0
00056 #endif
00057 
00058 
00060 #if !defined(__GNUC__) || (__GNUC__ < 2) || \
00061     ((__GNUC__ == 2) && (__GNUC_MINOR__ <= 7))
00062 # define LONGSTRING
00063 #else
00064 # define LONGSTRING __extension__
00065 #endif
00066 
00070 /**********************************************************************/
00073 
00075 #define MALLOC(BYTES)      _mesa_malloc(BYTES)
00076 
00077 #define CALLOC(BYTES)      _mesa_calloc(BYTES)
00078 
00079 #define MALLOC_STRUCT(T)   (struct T *) _mesa_malloc(sizeof(struct T))
00080 
00081 #define CALLOC_STRUCT(T)   (struct T *) _mesa_calloc(sizeof(struct T))
00082 
00083 #define FREE(PTR)          _mesa_free(PTR)
00084 
00086 #define ALIGN_MALLOC(BYTES, N)     _mesa_align_malloc(BYTES, N)
00087 
00088 #define ALIGN_CALLOC(BYTES, N)     _mesa_align_calloc(BYTES, N)
00089 
00090 #define ALIGN_MALLOC_STRUCT(T, N)  (struct T *) _mesa_align_malloc(sizeof(struct T), N)
00091 
00092 #define ALIGN_CALLOC_STRUCT(T, N)  (struct T *) _mesa_align_calloc(sizeof(struct T), N)
00093 
00094 #define ALIGN_FREE(PTR)            _mesa_align_free(PTR)
00095 
00097 #define MEMCPY( DST, SRC, BYTES)   _mesa_memcpy(DST, SRC, BYTES)
00098 
00099 #define MEMSET( DST, VAL, N )      _mesa_memset(DST, VAL, N)
00100 
00104 /*
00105  * For GL_ARB_vertex_buffer_object we need to treat vertex array pointers
00106  * as offsets into buffer stores.  Since the vertex array pointer and
00107  * buffer store pointer are both pointers and we need to add them, we use
00108  * this macro.
00109  * Both pointers/offsets are expressed in bytes.
00110  */
00111 #define ADD_POINTERS(A, B)  ( (GLubyte *) (A) + (uintptr_t) (B) )
00112 
00113 
00122 typedef union { GLfloat f; GLint i; } fi_type;
00123 
00124 
00125 
00126 /**********************************************************************
00127  * Math macros
00128  */
00129 
00130 #define MAX_GLUSHORT    0xffff
00131 #define MAX_GLUINT  0xffffffff
00132 
00133 #ifndef M_PI
00134 #define M_PI (3.1415926536)
00135 #endif
00136 
00137 #ifndef M_E
00138 #define M_E (2.7182818284590452354)
00139 #endif
00140 
00141 #ifndef ONE_DIV_LN2
00142 #define ONE_DIV_LN2 (1.442695040888963456)
00143 #endif
00144 
00145 #ifndef ONE_DIV_SQRT_LN2
00146 #define ONE_DIV_SQRT_LN2 (1.201122408786449815)
00147 #endif
00148 
00149 #ifndef FLT_MAX_EXP
00150 #define FLT_MAX_EXP 128
00151 #endif
00152 
00153 /* Degrees to radians conversion: */
00154 #define DEG2RAD (M_PI/180.0)
00155 
00156 
00157 /***
00158  *** USE_IEEE: Determine if we're using IEEE floating point
00159  ***/
00160 #if defined(__i386__) || defined(__386__) || defined(__sparc__) || \
00161     defined(__s390x__) || defined(__powerpc__) || \
00162     defined(__x86_64__) || \
00163     defined(ia64) || defined(__ia64__) || \
00164     defined(__hppa__) || defined(hpux) || \
00165     defined(__mips) || defined(_MIPS_ARCH) || \
00166     defined(__arm__) || \
00167     defined(__sh__) || defined(__m32r__) || \
00168     (defined(__sun) && defined(_IEEE_754)) || \
00169     (defined(__alpha__) && (defined(__IEEE_FLOAT) || !defined(VMS)))
00170 #define USE_IEEE
00171 #define IEEE_ONE 0x3f800000
00172 #endif
00173 
00174 
00175 /***
00176  *** SQRTF: single-precision square root
00177  ***/
00178 #if 0 /* _mesa_sqrtf() not accurate enough - temporarily disabled */
00179 #  define SQRTF(X)  _mesa_sqrtf(X)
00180 #else
00181 #  define SQRTF(X)  (float) sqrt((float) (X))
00182 #endif
00183 
00184 
00185 /***
00186  *** INV_SQRTF: single-precision inverse square root
00187  ***/
00188 #if 0
00189 #define INV_SQRTF(X) _mesa_inv_sqrt(X)
00190 #else
00191 #define INV_SQRTF(X) (1.0F / SQRTF(X))  /* this is faster on a P4 */
00192 #endif
00193 
00194 
00195 /***
00196  *** LOG2: Log base 2 of float
00197  ***/
00198 #ifdef USE_IEEE
00199 #if 0
00200 /* This is pretty fast, but not accurate enough (only 2 fractional bits).
00201  * Based on code from http://www.stereopsis.com/log2.html
00202  */
00203 static INLINE GLfloat LOG2(GLfloat x)
00204 {
00205    const GLfloat y = x * x * x * x;
00206    const GLuint ix = *((GLuint *) &y);
00207    const GLuint exp = (ix >> 23) & 0xFF;
00208    const GLint log2 = ((GLint) exp) - 127;
00209    return (GLfloat) log2 * (1.0 / 4.0);  /* 4, because of x^4 above */
00210 }
00211 #endif
00212 /* Pretty fast, and accurate.
00213  * Based on code from http://www.flipcode.com/totd/
00214  */
00215 static INLINE GLfloat LOG2(GLfloat val)
00216 {
00217    fi_type num;
00218    GLint log_2;
00219    num.f = val;
00220    log_2 = ((num.i >> 23) & 255) - 128;
00221    num.i &= ~(255 << 23);
00222    num.i += 127 << 23;
00223    num.f = ((-1.0f/3) * num.f + 2) * num.f - 2.0f/3;
00224    return num.f + log_2;
00225 }
00226 #else
00227 /*
00228  * NOTE: log_base_2(x) = log(x) / log(2)
00229  * NOTE: 1.442695 = 1/log(2).
00230  */
00231 #define LOG2(x)  ((GLfloat) (log(x) * 1.442695F))
00232 #endif
00233 
00234 
00235 /***
00236  *** IS_INF_OR_NAN: test if float is infinite or NaN
00237  ***/
00238 #ifdef USE_IEEE
00239 static INLINE int IS_INF_OR_NAN( float x )
00240 {
00241    fi_type tmp;
00242    tmp.f = x;
00243    return !(int)((unsigned int)((tmp.i & 0x7fffffff)-0x7f800000) >> 31);
00244 }
00245 #elif defined(isfinite)
00246 #define IS_INF_OR_NAN(x)        (!isfinite(x))
00247 #elif defined(finite)
00248 #define IS_INF_OR_NAN(x)        (!finite(x))
00249 #elif defined(__VMS)
00250 #define IS_INF_OR_NAN(x)        (!finite(x))
00251 #elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
00252 #define IS_INF_OR_NAN(x)        (!isfinite(x))
00253 #else
00254 #define IS_INF_OR_NAN(x)        (!finite(x))
00255 #endif
00256 
00257 
00258 /***
00259  *** IS_NEGATIVE: test if float is negative
00260  ***/
00261 #if defined(USE_IEEE)
00262 static INLINE int GET_FLOAT_BITS( float x )
00263 {
00264    fi_type fi;
00265    fi.f = x;
00266    return fi.i;
00267 }
00268 #define IS_NEGATIVE(x) (GET_FLOAT_BITS(x) < 0)
00269 #else
00270 #define IS_NEGATIVE(x) (x < 0.0F)
00271 #endif
00272 
00273 
00274 /***
00275  *** DIFFERENT_SIGNS: test if two floats have opposite signs
00276  ***/
00277 #if defined(USE_IEEE)
00278 #define DIFFERENT_SIGNS(x,y) ((GET_FLOAT_BITS(x) ^ GET_FLOAT_BITS(y)) & (1<<31))
00279 #else
00280 /* Could just use (x*y<0) except for the flatshading requirements.
00281  * Maybe there's a better way?
00282  */
00283 #define DIFFERENT_SIGNS(x,y) ((x) * (y) <= 0.0F && (x) - (y) != 0.0F)
00284 #endif
00285 
00286 
00287 /***
00288  *** CEILF: ceiling of float
00289  *** FLOORF: floor of float
00290  *** FABSF: absolute value of float
00291  *** LOGF: the natural logarithm (base e) of the value
00292  *** EXPF: raise e to the value
00293  *** LDEXPF: multiply value by an integral power of two
00294  *** FREXPF: extract mantissa and exponent from value
00295  ***/
00296 #if defined(__gnu_linux__)
00297 /* C99 functions */
00298 #define CEILF(x)   ceilf(x)
00299 #define FLOORF(x)  floorf(x)
00300 #define FABSF(x)   fabsf(x)
00301 #define LOGF(x)    logf(x)
00302 #define EXPF(x)    expf(x)
00303 #define LDEXPF(x,y)  ldexpf(x,y)
00304 #define FREXPF(x,y)  frexpf(x,y)
00305 #else
00306 #define CEILF(x)   ((GLfloat) ceil(x))
00307 #define FLOORF(x)  ((GLfloat) floor(x))
00308 #define FABSF(x)   ((GLfloat) fabs(x))
00309 #define LOGF(x)    ((GLfloat) log(x))
00310 #define EXPF(x)    ((GLfloat) exp(x))
00311 #define LDEXPF(x,y)  ((GLfloat) ldexp(x,y))
00312 #define FREXPF(x,y)  ((GLfloat) frexp(x,y))
00313 #endif
00314 
00315 
00316 /***
00317  *** IROUND: return (as an integer) float rounded to nearest integer
00318  ***/
00319 #if defined(USE_SPARC_ASM) && defined(__GNUC__) && defined(__sparc__)
00320 static INLINE int iround(float f)
00321 {
00322    int r;
00323    __asm__ ("fstoi %1, %0" : "=f" (r) : "f" (f));
00324    return r;
00325 }
00326 #define IROUND(x)  iround(x)
00327 #elif defined(USE_X86_ASM) && defined(__GNUC__) && defined(__i386__) && \
00328             (!(defined(__BEOS__) || defined(__HAIKU__))  || \
00329             (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)))
00330 static INLINE int iround(float f)
00331 {
00332    int r;
00333    __asm__ ("fistpl %0" : "=m" (r) : "t" (f) : "st");
00334    return r;
00335 }
00336 #define IROUND(x)  iround(x)
00337 #elif defined(USE_X86_ASM) && defined(_MSC_VER)
00338 static INLINE int iround(float f)
00339 {
00340    int r;
00341    _asm {
00342      fld f
00343      fistp r
00344     }
00345    return r;
00346 }
00347 #define IROUND(x)  iround(x)
00348 #elif defined(__WATCOMC__) && defined(__386__)
00349 long iround(float f);
00350 #pragma aux iround =                    \
00351     "push   eax"                        \
00352     "fistp  dword ptr [esp]"            \
00353     "pop    eax"                        \
00354     parm [8087]                         \
00355     value [eax]                         \
00356     modify exact [eax];
00357 #define IROUND(x)  iround(x)
00358 #else
00359 #define IROUND(f)  ((int) (((f) >= 0.0F) ? ((f) + 0.5F) : ((f) - 0.5F)))
00360 #endif
00361 
00362 
00363 /***
00364  *** IROUND_POS: return (as an integer) positive float rounded to nearest int
00365  ***/
00366 #ifdef DEBUG
00367 #define IROUND_POS(f) (assert((f) >= 0.0F), IROUND(f))
00368 #else
00369 #define IROUND_POS(f) (IROUND(f))
00370 #endif
00371 
00372 
00373 /***
00374  *** IFLOOR: return (as an integer) floor of float
00375  ***/
00376 #if defined(USE_X86_ASM) && defined(__GNUC__) && defined(__i386__)
00377 /*
00378  * IEEE floor for computers that round to nearest or even.
00379  * 'f' must be between -4194304 and 4194303.
00380  * This floor operation is done by "(iround(f + .5) + iround(f - .5)) >> 1",
00381  * but uses some IEEE specific tricks for better speed.
00382  * Contributed by Josh Vanderhoof
00383  */
00384 static INLINE int ifloor(float f)
00385 {
00386    int ai, bi;
00387    double af, bf;
00388    af = (3 << 22) + 0.5 + (double)f;
00389    bf = (3 << 22) + 0.5 - (double)f;
00390    /* GCC generates an extra fstp/fld without this. */
00391    __asm__ ("fstps %0" : "=m" (ai) : "t" (af) : "st");
00392    __asm__ ("fstps %0" : "=m" (bi) : "t" (bf) : "st");
00393    return (ai - bi) >> 1;
00394 }
00395 #define IFLOOR(x)  ifloor(x)
00396 #elif defined(USE_IEEE)
00397 static INLINE int ifloor(float f)
00398 {
00399    int ai, bi;
00400    double af, bf;
00401    fi_type u;
00402 
00403    af = (3 << 22) + 0.5 + (double)f;
00404    bf = (3 << 22) + 0.5 - (double)f;
00405    u.f = (float) af;  ai = u.i;
00406    u.f = (float) bf;  bi = u.i;
00407    return (ai - bi) >> 1;
00408 }
00409 #define IFLOOR(x)  ifloor(x)
00410 #else
00411 static INLINE int ifloor(float f)
00412 {
00413    int i = IROUND(f);
00414    return (i > f) ? i - 1 : i;
00415 }
00416 #define IFLOOR(x)  ifloor(x)
00417 #endif
00418 
00419 
00420 /***
00421  *** ICEIL: return (as an integer) ceiling of float
00422  ***/
00423 #if defined(USE_X86_ASM) && defined(__GNUC__) && defined(__i386__)
00424 /*
00425  * IEEE ceil for computers that round to nearest or even.
00426  * 'f' must be between -4194304 and 4194303.
00427  * This ceil operation is done by "(iround(f + .5) + iround(f - .5) + 1) >> 1",
00428  * but uses some IEEE specific tricks for better speed.
00429  * Contributed by Josh Vanderhoof
00430  */
00431 static INLINE int iceil(float f)
00432 {
00433    int ai, bi;
00434    double af, bf;
00435    af = (3 << 22) + 0.5 + (double)f;
00436    bf = (3 << 22) + 0.5 - (double)f;
00437    /* GCC generates an extra fstp/fld without this. */
00438    __asm__ ("fstps %0" : "=m" (ai) : "t" (af) : "st");
00439    __asm__ ("fstps %0" : "=m" (bi) : "t" (bf) : "st");
00440    return (ai - bi + 1) >> 1;
00441 }
00442 #define ICEIL(x)  iceil(x)
00443 #elif defined(USE_IEEE)
00444 static INLINE int iceil(float f)
00445 {
00446    int ai, bi;
00447    double af, bf;
00448    fi_type u;
00449    af = (3 << 22) + 0.5 + (double)f;
00450    bf = (3 << 22) + 0.5 - (double)f;
00451    u.f = (float) af; ai = u.i;
00452    u.f = (float) bf; bi = u.i;
00453    return (ai - bi + 1) >> 1;
00454 }
00455 #define ICEIL(x)  iceil(x)
00456 #else
00457 static INLINE int iceil(float f)
00458 {
00459    int i = IROUND(f);
00460    return (i < f) ? i + 1 : i;
00461 }
00462 #define ICEIL(x)  iceil(x)
00463 #endif
00464 
00465 
00469 static INLINE int
00470 _mesa_is_pow_two(int x)
00471 {
00472    return !(x & (x - 1));
00473 }
00474 
00475 
00476 /***
00477  *** UNCLAMPED_FLOAT_TO_UBYTE: clamp float to [0,1] and map to ubyte in [0,255]
00478  *** CLAMPED_FLOAT_TO_UBYTE: map float known to be in [0,1] to ubyte in [0,255]
00479  ***/
00480 #if defined(USE_IEEE) && !defined(DEBUG)
00481 #define IEEE_0996 0x3f7f0000    /* 0.996 or so */
00482 /* This function/macro is sensitive to precision.  Test very carefully
00483  * if you change it!
00484  */
00485 #define UNCLAMPED_FLOAT_TO_UBYTE(UB, F_)                    \
00486         do {                                \
00487            fi_type __tmp;                       \
00488            __tmp.f = (F_);                      \
00489            if (__tmp.i < 0)                     \
00490               UB = (GLubyte) 0;                     \
00491            else if (__tmp.i >= IEEE_0996)               \
00492               UB = (GLubyte) 255;                   \
00493            else {                           \
00494               __tmp.f = __tmp.f * (255.0F/256.0F) + 32768.0F;       \
00495               UB = (GLubyte) __tmp.i;                   \
00496            }                                \
00497         } while (0)
00498 #define CLAMPED_FLOAT_TO_UBYTE(UB, F_)                  \
00499         do {                                \
00500            fi_type __tmp;                       \
00501            __tmp.f = (F_) * (255.0F/256.0F) + 32768.0F;         \
00502            UB = (GLubyte) __tmp.i;                  \
00503         } while (0)
00504 #else
00505 #define UNCLAMPED_FLOAT_TO_UBYTE(ub, f) \
00506     ub = ((GLubyte) IROUND(CLAMP((f), 0.0F, 1.0F) * 255.0F))
00507 #define CLAMPED_FLOAT_TO_UBYTE(ub, f) \
00508     ub = ((GLubyte) IROUND((f) * 255.0F))
00509 #endif
00510 
00511 
00512 /***
00513  *** START_FAST_MATH: Set x86 FPU to faster, 32-bit precision mode (and save
00514  ***                  original mode to a temporary).
00515  *** END_FAST_MATH: Restore x86 FPU to original mode.
00516  ***/
00517 #if defined(__GNUC__) && defined(__i386__)
00518 /*
00519  * Set the x86 FPU control word to guarentee only 32 bits of precision
00520  * are stored in registers.  Allowing the FPU to store more introduces
00521  * differences between situations where numbers are pulled out of memory
00522  * vs. situations where the compiler is able to optimize register usage.
00523  *
00524  * In the worst case, we force the compiler to use a memory access to
00525  * truncate the float, by specifying the 'volatile' keyword.
00526  */
00527 /* Hardware default: All exceptions masked, extended double precision,
00528  * round to nearest (IEEE compliant):
00529  */
00530 #define DEFAULT_X86_FPU     0x037f
00531 /* All exceptions masked, single precision, round to nearest:
00532  */
00533 #define FAST_X86_FPU        0x003f
00534 /* The fldcw instruction will cause any pending FP exceptions to be
00535  * raised prior to entering the block, and we clear any pending
00536  * exceptions before exiting the block.  Hence, asm code has free
00537  * reign over the FPU while in the fast math block.
00538  */
00539 #if defined(NO_FAST_MATH)
00540 #define START_FAST_MATH(x)                      \
00541 do {                                    \
00542    static GLuint mask = DEFAULT_X86_FPU;                \
00543    __asm__ ( "fnstcw %0" : "=m" (*&(x)) );              \
00544    __asm__ ( "fldcw %0" : : "m" (mask) );               \
00545 } while (0)
00546 #else
00547 #define START_FAST_MATH(x)                      \
00548 do {                                    \
00549    static GLuint mask = FAST_X86_FPU;                   \
00550    __asm__ ( "fnstcw %0" : "=m" (*&(x)) );              \
00551    __asm__ ( "fldcw %0" : : "m" (mask) );               \
00552 } while (0)
00553 #endif
00554 /* Restore original FPU mode, and clear any exceptions that may have
00555  * occurred in the FAST_MATH block.
00556  */
00557 #define END_FAST_MATH(x)                        \
00558 do {                                    \
00559    __asm__ ( "fnclex ; fldcw %0" : : "m" (*&(x)) );         \
00560 } while (0)
00561 
00562 #elif defined(__WATCOMC__) && defined(__386__)
00563 #define DEFAULT_X86_FPU     0x037f /* See GCC comments above */
00564 #define FAST_X86_FPU        0x003f /* See GCC comments above */
00565 void _watcom_start_fast_math(unsigned short *x,unsigned short *mask);
00566 #pragma aux _watcom_start_fast_math =                                   \
00567    "fnstcw  word ptr [eax]"                                             \
00568    "fldcw   word ptr [ecx]"                                             \
00569    parm [eax] [ecx]                                                     \
00570    modify exact [];
00571 void _watcom_end_fast_math(unsigned short *x);
00572 #pragma aux _watcom_end_fast_math =                                     \
00573    "fnclex"                                                             \
00574    "fldcw   word ptr [eax]"                                             \
00575    parm [eax]                                                           \
00576    modify exact [];
00577 #if defined(NO_FAST_MATH)
00578 #define START_FAST_MATH(x)                                              \
00579 do {                                                                    \
00580    static GLushort mask = DEFAULT_X86_FPU;                              \
00581    _watcom_start_fast_math(&x,&mask);                                   \
00582 } while (0)
00583 #else
00584 #define START_FAST_MATH(x)                                              \
00585 do {                                                                    \
00586    static GLushort mask = FAST_X86_FPU;                                 \
00587    _watcom_start_fast_math(&x,&mask);                                   \
00588 } while (0)
00589 #endif
00590 #define END_FAST_MATH(x)  _watcom_end_fast_math(&x)
00591 
00592 #elif defined(_MSC_VER) && defined(_M_IX86)
00593 #define DEFAULT_X86_FPU     0x037f /* See GCC comments above */
00594 #define FAST_X86_FPU        0x003f /* See GCC comments above */
00595 #if defined(NO_FAST_MATH)
00596 #define START_FAST_MATH(x) do {\
00597     static GLuint mask = DEFAULT_X86_FPU;\
00598     __asm fnstcw word ptr [x]\
00599     __asm fldcw word ptr [mask]\
00600 } while(0)
00601 #else
00602 #define START_FAST_MATH(x) do {\
00603     static GLuint mask = FAST_X86_FPU;\
00604     __asm fnstcw word ptr [x]\
00605     __asm fldcw word ptr [mask]\
00606 } while(0)
00607 #endif
00608 #define END_FAST_MATH(x) do {\
00609     __asm fnclex\
00610     __asm fldcw word ptr [x]\
00611 } while(0)
00612 
00613 #else
00614 #define START_FAST_MATH(x)  x = 0
00615 #define END_FAST_MATH(x)  (void)(x)
00616 #endif
00617 
00618 
00622 static INLINE GLboolean
00623 _mesa_little_endian(void)
00624 {
00625    const GLuint ui = 1; /* intentionally not static */
00626    return *((const GLubyte *) &ui);
00627 }
00628 
00629 
00630 
00631 /**********************************************************************
00632  * Functions
00633  */
00634 
00635 extern void *
00636 _mesa_malloc( size_t bytes );
00637 
00638 extern void *
00639 _mesa_calloc( size_t bytes );
00640 
00641 extern void
00642 _mesa_free( void *ptr );
00643 
00644 extern void *
00645 _mesa_align_malloc( size_t bytes, unsigned long alignment );
00646 
00647 extern void *
00648 _mesa_align_calloc( size_t bytes, unsigned long alignment );
00649 
00650 extern void
00651 _mesa_align_free( void *ptr );
00652 
00653 extern void *
00654 _mesa_align_realloc(void *oldBuffer, size_t oldSize, size_t newSize,
00655                     unsigned long alignment);
00656 
00657 extern void *
00658 _mesa_exec_malloc( GLuint size );
00659 
00660 extern void 
00661 _mesa_exec_free( void *addr );
00662 
00663 extern void *
00664 _mesa_realloc( void *oldBuffer, size_t oldSize, size_t newSize );
00665 
00666 extern void *
00667 _mesa_memcpy( void *dest, const void *src, size_t n );
00668 
00669 extern void
00670 _mesa_memset( void *dst, int val, size_t n );
00671 
00672 extern void
00673 _mesa_memset16( unsigned short *dst, unsigned short val, size_t n );
00674 
00675 extern void
00676 _mesa_bzero( void *dst, size_t n );
00677 
00678 extern int
00679 _mesa_memcmp( const void *s1, const void *s2, size_t n );
00680 
00681 extern double
00682 _mesa_sin(double a);
00683 
00684 extern float
00685 _mesa_sinf(float a);
00686 
00687 extern double
00688 _mesa_cos(double a);
00689 
00690 extern float
00691 _mesa_asinf(float x);
00692 
00693 extern float
00694 _mesa_atanf(float x);
00695 
00696 extern double
00697 _mesa_sqrtd(double x);
00698 
00699 extern float
00700 _mesa_sqrtf(float x);
00701 
00702 extern float
00703 _mesa_inv_sqrtf(float x);
00704 
00705 extern void
00706 _mesa_init_sqrt_table(void);
00707 
00708 extern double
00709 _mesa_pow(double x, double y);
00710 
00711 extern int
00712 _mesa_ffs(int i);
00713 
00714 extern int
00715 #ifdef __MINGW32__
00716 _mesa_ffsll(long i);
00717 #else
00718 _mesa_ffsll(long long i);
00719 #endif
00720 
00721 extern unsigned int
00722 _mesa_bitcount(unsigned int n);
00723 
00724 extern GLhalfARB
00725 _mesa_float_to_half(float f);
00726 
00727 extern float
00728 _mesa_half_to_float(GLhalfARB h);
00729 
00730 
00731 extern void *
00732 _mesa_bsearch( const void *key, const void *base, size_t nmemb, size_t size, 
00733                int (*compar)(const void *, const void *) );
00734 
00735 extern char *
00736 _mesa_getenv( const char *var );
00737 
00738 extern char *
00739 _mesa_strstr( const char *haystack, const char *needle );
00740 
00741 extern char *
00742 _mesa_strncat( char *dest, const char *src, size_t n );
00743 
00744 extern char *
00745 _mesa_strcpy( char *dest, const char *src );
00746 
00747 extern char *
00748 _mesa_strncpy( char *dest, const char *src, size_t n );
00749 
00750 extern size_t
00751 _mesa_strlen( const char *s );
00752 
00753 extern int
00754 _mesa_strcmp( const char *s1, const char *s2 );
00755 
00756 extern int
00757 _mesa_strncmp( const char *s1, const char *s2, size_t n );
00758 
00759 extern char *
00760 _mesa_strdup( const char *s );
00761 
00762 extern int
00763 _mesa_atoi( const char *s );
00764 
00765 extern double
00766 _mesa_strtod( const char *s, char **end );
00767 
00768 extern int
00769 _mesa_sprintf( char *str, const char *fmt, ... );
00770 
00771 extern int
00772 _mesa_snprintf( char *str, size_t size, const char *fmt, ... );
00773 
00774 extern void
00775 _mesa_printf( const char *fmtString, ... );
00776 
00777 extern void
00778 _mesa_fprintf( FILE *f, const char *fmtString, ... );
00779 
00780 extern int 
00781 _mesa_vsprintf( char *str, const char *fmt, va_list args );
00782 
00783 
00784 extern void
00785 _mesa_warning( __GLcontext *gc, const char *fmtString, ... );
00786 
00787 extern void
00788 _mesa_problem( const __GLcontext *ctx, const char *fmtString, ... );
00789 
00790 extern void
00791 _mesa_error( __GLcontext *ctx, GLenum error, const char *fmtString, ... );
00792 
00793 extern void
00794 _mesa_debug( const __GLcontext *ctx, const char *fmtString, ... );
00795 
00796 extern void 
00797 _mesa_exit( int status );
00798 
00799 
00800 #ifdef __cplusplus
00801 }
00802 #endif
00803 
00804 
00805 #endif /* IMPORTS_H */

Generated on Fri May 25 2012 04:17:45 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.