亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? imports.c

?? Mesa is an open-source implementation of the OpenGL specification - a system for rendering interacti
?? C
?? 第 1 頁 / 共 2 頁
字號:
/** * \file imports.c * Standard C library function wrappers. *  * Imports are services which the device driver or window system or * operating system provides to the core renderer.  The core renderer (Mesa) * will call these functions in order to do memory allocation, simple I/O, * etc. * * Some drivers will want to override/replace this file with something * specialized, but that'll be rare. * * Eventually, I want to move roll the glheader.h file into this. * * \todo Functions still needed: * - scanf * - qsort * - rand and RAND_MAX *//* * Mesa 3-D graphics library * Version:  7.1 * * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */#include "imports.h"#include "context.h"#include "version.h"#define MAXSTRING 4000  /* for vsnprintf() */#ifdef WIN32#define vsnprintf _vsnprintf#elif defined(__IBMC__) || defined(__IBMCPP__) || ( defined(__VMS) && __CRTL_VER < 70312000 )extern int vsnprintf(char *str, size_t count, const char *fmt, va_list arg);#ifdef __VMS#include "vsnprintf.c"#endif#endif/**********************************************************************//** \name Memory *//*@{*//** Wrapper around malloc() */void *_mesa_malloc(size_t bytes){   return malloc(bytes);}/** Wrapper around calloc() */void *_mesa_calloc(size_t bytes){   return calloc(1, bytes);}/** Wrapper around free() */void_mesa_free(void *ptr){   free(ptr);}/** * Allocate aligned memory. * * \param bytes number of bytes to allocate. * \param alignment alignment (must be greater than zero). *  * Allocates extra memory to accommodate rounding up the address for * alignment and to record the real malloc address. * * \sa _mesa_align_free(). */void *_mesa_align_malloc(size_t bytes, unsigned long alignment){#if defined(HAVE_POSIX_MEMALIGN)   void *mem;   (void) posix_memalign(& mem, alignment, bytes);   return mem;#elif defined(_WIN32) && defined(_MSC_VER)   return _aligned_malloc(bytes, alignment);#else   uintptr_t ptr, buf;   ASSERT( alignment > 0 );   ptr = (uintptr_t) _mesa_malloc(bytes + alignment + sizeof(void *));   if (!ptr)      return NULL;   buf = (ptr + alignment + sizeof(void *)) & ~(uintptr_t)(alignment - 1);   *(uintptr_t *)(buf - sizeof(void *)) = ptr;#ifdef DEBUG   /* mark the non-aligned area */   while ( ptr < buf - sizeof(void *) ) {      *(unsigned long *)ptr = 0xcdcdcdcd;      ptr += sizeof(unsigned long);   }#endif   return (void *) buf;#endif /* defined(HAVE_POSIX_MEMALIGN) */}/** * Same as _mesa_align_malloc(), but using _mesa_calloc() instead of * _mesa_malloc() */void *_mesa_align_calloc(size_t bytes, unsigned long alignment){#if defined(HAVE_POSIX_MEMALIGN)   void *mem;      mem = _mesa_align_malloc(bytes, alignment);   if (mem != NULL) {      (void) memset(mem, 0, bytes);   }   return mem;#elif defined(_WIN32) && defined(_MSC_VER)   void *mem;   mem = _aligned_malloc(bytes, alignment);   if (mem != NULL) {      (void) memset(mem, 0, bytes);   }   return mem;#else   uintptr_t ptr, buf;   ASSERT( alignment > 0 );   ptr = (uintptr_t) _mesa_calloc(bytes + alignment + sizeof(void *));   if (!ptr)      return NULL;   buf = (ptr + alignment + sizeof(void *)) & ~(uintptr_t)(alignment - 1);   *(uintptr_t *)(buf - sizeof(void *)) = ptr;#ifdef DEBUG   /* mark the non-aligned area */   while ( ptr < buf - sizeof(void *) ) {      *(unsigned long *)ptr = 0xcdcdcdcd;      ptr += sizeof(unsigned long);   }#endif   return (void *)buf;#endif /* defined(HAVE_POSIX_MEMALIGN) */}/** * Free memory which was allocated with either _mesa_align_malloc() * or _mesa_align_calloc(). * \param ptr pointer to the memory to be freed. * The actual address to free is stored in the word immediately before the * address the client sees. */void_mesa_align_free(void *ptr){#if defined(HAVE_POSIX_MEMALIGN)   free(ptr);#elif defined(_WIN32) && defined(_MSC_VER)   _aligned_free(ptr);#else   void **cubbyHole = (void **) ((char *) ptr - sizeof(void *));   void *realAddr = *cubbyHole;   _mesa_free(realAddr);#endif /* defined(HAVE_POSIX_MEMALIGN) */}/** * Reallocate memory, with alignment. */void *_mesa_align_realloc(void *oldBuffer, size_t oldSize, size_t newSize,                    unsigned long alignment){#if defined(_WIN32) && defined(_MSC_VER)   (void) oldSize;   return _aligned_realloc(oldBuffer, newSize, alignment);#else   const size_t copySize = (oldSize < newSize) ? oldSize : newSize;   void *newBuf = _mesa_align_malloc(newSize, alignment);   if (newBuf && oldBuffer && copySize > 0) {      _mesa_memcpy(newBuf, oldBuffer, copySize);   }   if (oldBuffer)      _mesa_align_free(oldBuffer);   return newBuf;#endif}/** Reallocate memory */void *_mesa_realloc(void *oldBuffer, size_t oldSize, size_t newSize){   const size_t copySize = (oldSize < newSize) ? oldSize : newSize;   void *newBuffer = _mesa_malloc(newSize);   if (newBuffer && oldBuffer && copySize > 0)      _mesa_memcpy(newBuffer, oldBuffer, copySize);   if (oldBuffer)      _mesa_free(oldBuffer);   return newBuffer;}/** memcpy wrapper */void *_mesa_memcpy(void *dest, const void *src, size_t n){#if defined(SUNOS4)   return memcpy((char *) dest, (char *) src, (int) n);#else   return memcpy(dest, src, n);#endif}/** Wrapper around memset() */void_mesa_memset( void *dst, int val, size_t n ){#if defined(SUNOS4)   memset( (char *) dst, (int) val, (int) n );#else   memset(dst, val, n);#endif}/** * Fill memory with a constant 16bit word. * \param dst destination pointer. * \param val value. * \param n number of words. */void_mesa_memset16( unsigned short *dst, unsigned short val, size_t n ){   while (n-- > 0)      *dst++ = val;}/** Wrapper around either memset() or bzero() */void_mesa_bzero( void *dst, size_t n ){#if defined(__FreeBSD__)   bzero( dst, n );#else   memset( dst, 0, n );#endif}/** Wrapper around memcmp() */int_mesa_memcmp( const void *s1, const void *s2, size_t n ){#if defined(SUNOS4)   return memcmp( (char *) s1, (char *) s2, (int) n );#else   return memcmp(s1, s2, n);#endif}/*@}*//**********************************************************************//** \name Math *//*@{*//** Wrapper around sin() */double_mesa_sin(double a){   return sin(a);}/** Single precision wrapper around sin() */float_mesa_sinf(float a){   return (float) sin((double) a);}/** Wrapper around cos() */double_mesa_cos(double a){   return cos(a);}/** Single precision wrapper around asin() */float_mesa_asinf(float x){   return (float) asin((double) x);}/** Single precision wrapper around atan() */float_mesa_atanf(float x){   return (float) atan((double) x);}/** Wrapper around sqrt() */double_mesa_sqrtd(double x){   return sqrt(x);}/* * A High Speed, Low Precision Square Root * by Paul Lalonde and Robert Dawson * from "Graphics Gems", Academic Press, 1990 * * SPARC implementation of a fast square root by table * lookup. * SPARC floating point format is as follows: * * BIT 31 	30 	23 	22 	0 *     sign	exponent	mantissa */static short sqrttab[0x100];    /* declare table of square roots */void_mesa_init_sqrt_table(void){#if defined(USE_IEEE) && !defined(DEBUG)   unsigned short i;   fi_type fi;     /* to access the bits of a float in  C quickly  */                   /* we use a union defined in glheader.h         */   for(i=0; i<= 0x7f; i++) {      fi.i = 0;      /*       * Build a float with the bit pattern i as mantissa       * and an exponent of 0, stored as 127       */      fi.i = (i << 16) | (127 << 23);      fi.f = _mesa_sqrtd(fi.f);      /*       * Take the square root then strip the first 7 bits of       * the mantissa into the table       */      sqrttab[i] = (fi.i & 0x7fffff) >> 16;      /*       * Repeat the process, this time with an exponent of       * 1, stored as 128       */      fi.i = 0;      fi.i = (i << 16) | (128 << 23);      fi.f = sqrt(fi.f);      sqrttab[i+0x80] = (fi.i & 0x7fffff) >> 16;   }#else   (void) sqrttab;  /* silence compiler warnings */#endif /*HAVE_FAST_MATH*/}/** * Single precision square root. */float_mesa_sqrtf( float x ){#if defined(USE_IEEE) && !defined(DEBUG)   fi_type num;                                /* to access the bits of a float in C                                 * we use a union from glheader.h     */   short e;                     /* the exponent */   if (x == 0.0F) return 0.0F;  /* check for square root of 0 */   num.f = x;   e = (num.i >> 23) - 127;     /* get the exponent - on a SPARC the */                                /* exponent is stored with 127 added */   num.i &= 0x7fffff;           /* leave only the mantissa */   if (e & 0x01) num.i |= 0x800000;                                /* the exponent is odd so we have to */                                /* look it up in the second half of  */                                /* the lookup table, so we set the   */                                /* high bit                                */   e >>= 1;                     /* divide the exponent by two */                                /* note that in C the shift */                                /* operators are sign preserving */                                /* for signed operands */   /* Do the table lookup, based on the quaternary mantissa,    * then reconstruct the result back into a float    */   num.i = ((sqrttab[num.i >> 16]) << 16) | ((e + 127) << 23);   return num.f;#else   return (float) _mesa_sqrtd((double) x);#endif}/** inv_sqrt - A single precision 1/sqrt routine for IEEE format floats. written by Josh Vanderhoof, based on newsgroup posts by James Van Buskirk and Vesa Karvonen.*/float_mesa_inv_sqrtf(float n){#if defined(USE_IEEE) && !defined(DEBUG)        float r0, x0, y0;        float r1, x1, y1;        float r2, x2, y2;#if 0 /* not used, see below -BP */        float r3, x3, y3;#endif        union { float f; unsigned int i; } u;        unsigned int magic;        /*         Exponent part of the magic number -         We want to:         1. subtract the bias from the exponent,         2. negate it         3. divide by two (rounding towards -inf)         4. add the bias back         Which is the same as subtracting the exponent from 381 and dividing         by 2.         floor(-(x - 127) / 2) + 127 = floor((381 - x) / 2)        */        magic = 381 << 23;        /*         Significand part of magic number -         With the current magic number, "(magic - u.i) >> 1" will give you:         for 1 <= u.f <= 2: 1.25 - u.f / 4         for 2 <= u.f <= 4: 1.00 - u.f / 8         This isn't a bad approximation of 1/sqrt.  The maximum difference from         1/sqrt will be around .06.  After three Newton-Raphson iterations, the         maximum difference is less than 4.5e-8.  (Which is actually close         enough to make the following bias academic...)         To get a better approximation you can add a bias to the magic         number.  For example, if you subtract 1/2 of the maximum difference in         the first approximation (.03), you will get the following function:         for 1 <= u.f <= 2:    1.22 - u.f / 4         for 2 <= u.f <= 3.76: 0.97 - u.f / 8         for 3.76 <= u.f <= 4: 0.72 - u.f / 16         (The 3.76 to 4 range is where the result is < .5.)         This is the closest possible initial approximation, but with a maximum         error of 8e-11 after three NR iterations, it is still not perfect.  If         you subtract 0.0332281 instead of .03, the maximum error will be         2.5e-11 after three NR iterations, which should be about as close as         is possible.         for 1 <= u.f <= 2:    1.2167719 - u.f / 4         for 2 <= u.f <= 3.73: 0.9667719 - u.f / 8         for 3.73 <= u.f <= 4: 0.7167719 - u.f / 16        */        magic -= (int)(0.0332281 * (1 << 25));        u.f = n;        u.i = (magic - u.i) >> 1;        /*         Instead of Newton-Raphson, we use Goldschmidt's algorithm, which         allows more parallelism.  From what I understand, the parallelism         comes at the cost of less precision, because it lets error         accumulate across iterations.        */        x0 = 1.0f;        y0 = 0.5f * n;        r0 = u.f;        x1 = x0 * r0;        y1 = y0 * r0 * r0;        r1 = 1.5f - y1;        x2 = x1 * r1;        y2 = y1 * r1 * r1;        r2 = 1.5f - y2;#if 1        return x2 * r2;  /* we can stop here, and be conformant -BP */#else        x3 = x2 * r2;        y3 = y2 * r2 * r2;        r3 = 1.5f - y3;        return x3 * r3;#endif#else        return (float) (1.0 / sqrt(n));#endif}/** Wrapper around pow() */double_mesa_pow(double x, double y){   return pow(x, y);}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
jiyouzz国产精品久久| 日韩视频免费观看高清完整版在线观看 | 国产精品久久久久一区| 亚洲6080在线| 波多野洁衣一区| 欧美大片在线观看一区二区| 亚洲欧美激情小说另类| 国产综合久久久久久久久久久久| 欧美性一二三区| 亚洲婷婷在线视频| 国产精一区二区三区| 日韩一区二区三区四区五区六区| 1024成人网| 成人黄色777网| 久久久综合九色合综国产精品| 亚洲国产成人高清精品| 色综合久久久久久久| 国产精品蜜臀av| 粉嫩在线一区二区三区视频| 亚洲精品一区二区三区四区高清| 国产传媒日韩欧美成人| 欧美一区二区三区视频免费播放| 一区二区三区免费| 色综合色综合色综合色综合色综合| 久久久精品蜜桃| 国产成人精品免费视频网站| 久久久久久综合| 国产精品中文字幕欧美| 精品国产91久久久久久久妲己| 久久综合综合久久综合| 欧美一区二区三区视频在线 | 日本乱人伦一区| 综合久久久久久| 91麻豆国产福利在线观看| 中文字幕制服丝袜一区二区三区 | 九九国产精品视频| 日韩欧美三级在线| 国产中文字幕一区| 久久午夜国产精品| 成人美女视频在线看| 最新国产成人在线观看| 欧美最猛性xxxxx直播| 亚洲福利一二三区| 制服.丝袜.亚洲.中文.综合| 美女精品一区二区| 国产日韩亚洲欧美综合| 国产成人aaa| 亚洲免费av在线| 欧美美女网站色| 国产精品一区二区在线播放| 国产精品久久久久久久久免费相片 | 色婷婷久久99综合精品jk白丝| 亚洲天堂免费看| 欧美性三三影院| 日本不卡视频一二三区| 国产丝袜欧美中文另类| 成人久久久精品乱码一区二区三区| 日韩一区在线播放| 欧美日韩一区在线观看| 激情都市一区二区| 亚洲欧美另类综合偷拍| 欧美一区二区视频在线观看2020| 国产一区二区在线影院| 亚洲欧美日韩国产另类专区| 亚洲狠狠丁香婷婷综合久久久| 欧美丰满少妇xxxxx高潮对白| 激情小说欧美图片| 亚洲品质自拍视频网站| 欧美大片拔萝卜| 91浏览器在线视频| 加勒比av一区二区| 一区二区三区影院| 久久综合一区二区| 欧美视频一区在线| 国产成人自拍在线| 日韩国产欧美在线视频| 国产精品色呦呦| 日韩欧美专区在线| 91黄色免费版| 丁香婷婷综合色啪| 美女精品一区二区| 亚洲国产精品精华液网站| 国产偷v国产偷v亚洲高清| 777午夜精品视频在线播放| 成人国产一区二区三区精品| 免费看精品久久片| 亚洲午夜激情网站| 中文字幕一区二| 久久久亚洲高清| 欧美一卡2卡三卡4卡5免费| 色综合天天综合网国产成人综合天| 蜜臀av一区二区在线免费观看| 一区二区三区毛片| 最新国产精品久久精品| 久久久久97国产精华液好用吗| 欧美一区二区三区在| 欧美日韩一区国产| 91美女片黄在线| 成人avav在线| 国产成a人亚洲精| 狠狠狠色丁香婷婷综合激情 | 国产性做久久久久久| 日韩欧美国产综合| 欧美一卡二卡在线| 日韩欧美黄色影院| 欧美一区二区日韩一区二区| 欧美日韩一卡二卡| 欧美在线视频日韩| 欧美日韩免费一区二区三区| 色8久久精品久久久久久蜜| 99久久99久久免费精品蜜臀| 成人禁用看黄a在线| 成人中文字幕在线| 成人中文字幕合集| av欧美精品.com| 99久久国产综合精品女不卡| 成人av资源站| av不卡免费电影| 色天使久久综合网天天| 91在线无精精品入口| 色婷婷综合中文久久一本| 色老综合老女人久久久| 在线观看日韩精品| 欧美精品vⅰdeose4hd| 日韩午夜av电影| 精品久久久久久久人人人人传媒 | 欧美激情在线免费观看| 亚洲国产精品黑人久久久| 国产精品国产成人国产三级| 亚洲精品成人少妇| 亚洲不卡在线观看| 久久国产精品99精品国产 | 91久久精品一区二区二区| 欧美日韩在线播| 日韩欧美一区二区久久婷婷| 精品国产一区二区三区久久影院| 欧美电影免费提供在线观看| 久久综合久久久久88| 国产精品毛片大码女人| 亚洲午夜av在线| 蜜臀99久久精品久久久久久软件| 国产揄拍国内精品对白| 99久久免费国产| 91麻豆精品国产91| 国产精品午夜在线| 午夜精品在线看| 国产精品456露脸| 欧美三级韩国三级日本三斤| 337p粉嫩大胆噜噜噜噜噜91av| 国产精品不卡视频| 日本vs亚洲vs韩国一区三区二区 | 91免费观看视频在线| 91精品国产综合久久久久| 国产午夜精品福利| 亚洲一区二区精品视频| 国产乱子伦视频一区二区三区 | 亚洲图片激情小说| 秋霞电影网一区二区| 不卡的av电影在线观看| 欧美日韩www| 国产精品久久久久毛片软件| 老司机免费视频一区二区三区| 成人18视频日本| 欧美成人一区二区三区| 亚洲最色的网站| 成人黄色av电影| 精品国产髙清在线看国产毛片| 亚洲欧美一区二区三区国产精品 | 日韩欧美精品在线视频| 亚洲日本在线观看| 精品一区二区三区在线观看国产 | 不卡的av在线播放| 欧美不卡在线视频| 午夜精品久久久| 色婷婷久久一区二区三区麻豆| 国产日韩亚洲欧美综合| 麻豆国产欧美一区二区三区| 欧美日韩一区二区三区免费看| 国产精品区一区二区三区 | 日韩精品乱码免费| 色美美综合视频| 国产精品久久久久婷婷| 国产91精品久久久久久久网曝门| 欧美成人综合网站| 免费观看一级欧美片| 欧美一区二区二区| 五月激情综合网| 欧美老肥妇做.爰bbww视频| 亚洲免费电影在线| 91在线视频网址| 亚洲色图色小说| 99精品1区2区| 中文字幕一区在线观看视频| 粉嫩av一区二区三区在线播放| 精品国产亚洲在线| 久久99久久99| 久久婷婷综合激情| 国产精品亚洲午夜一区二区三区 | 日韩一区二区三区在线视频| 天天av天天翘天天综合网色鬼国产|