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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? memory.c

?? nVidia開發(fā)的圖形語言 Cg
?? C
字號:
/****************************************************************************\
Copyright (c) 2002, NVIDIA Corporation.

NVIDIA Corporation("NVIDIA") supplies this software to you in
consideration of your agreement to the following terms, and your use,
installation, modification or redistribution of this NVIDIA software
constitutes acceptance of these terms.  If you do not agree with these
terms, please do not use, install, modify or redistribute this NVIDIA
software.

In consideration of your agreement to abide by the following terms, and
subject to these terms, NVIDIA grants you a personal, non-exclusive
license, under NVIDIA's copyrights in this original NVIDIA software (the
"NVIDIA Software"), to use, reproduce, modify and redistribute the
NVIDIA Software, with or without modifications, in source and/or binary
forms; provided that if you redistribute the NVIDIA Software, you must
retain the copyright notice of NVIDIA, this notice and the following
text and disclaimers in all such redistributions of the NVIDIA Software.
Neither the name, trademarks, service marks nor logos of NVIDIA
Corporation may be used to endorse or promote products derived from the
NVIDIA Software without specific prior written permission from NVIDIA.
Except as expressly stated in this notice, no other rights or licenses
express or implied, are granted by NVIDIA herein, including but not
limited to any patent rights that may be infringed by your derivative
works or by other works in which the NVIDIA Software may be
incorporated. No hardware is licensed hereunder. 

THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
PRODUCTS.

IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\****************************************************************************/
#include <stddef.h>
#include <stdlib.h>
#include <string.h>

#ifdef __STDC99__
#include <stdint.h>
#else
typedef unsigned int uintptr_t;
#endif

#include "memory.h"

// default alignment and chunksize, if called with 0 arguments
#define CHUNKSIZE       (64*1024)
#define ALIGN           8

// we need to call the `real' malloc and free, not our replacements
#undef malloc
#undef free

struct chunk {
    struct chunk        *next;
};

struct cleanup {
    struct cleanup      *next;
    void                (*fn)(void *);
    void                *arg;
};

struct MemoryPool_rec {
    struct chunk        *next;
    uintptr_t           free, end;
    size_t              chunksize;
    unsigned            alignmask;
    struct cleanup      *cleanup;
};

MemoryPool *mem_CreatePool(size_t chunksize, unsigned align)
{
    MemoryPool  *pool;

    if (align == 0) align = ALIGN;
    if (chunksize == 0) chunksize = CHUNKSIZE;
    if (align & (align-1)) return 0;
    if (chunksize < sizeof(MemoryPool)) return 0;
    if (chunksize & (align-1)) return 0;
    if (!(pool = malloc(chunksize))) return 0;
    pool->next = 0;
    pool->chunksize = chunksize;
    pool->alignmask = align-1;
    pool->free = ((uintptr_t)(pool + 1) + pool->alignmask) & ~pool->alignmask;
    pool->end = (uintptr_t)pool + chunksize;
    pool->cleanup = 0;
    return pool;
}

void mem_FreePool(MemoryPool *pool)
{
    struct cleanup      *cleanup;
    struct chunk        *p, *next;

    for (cleanup = pool->cleanup; cleanup; cleanup = cleanup->next) {
        cleanup->fn(cleanup->arg);
    }
    for (p = (struct chunk *)pool; p; p = next) {
        next = p->next;
        free(p);
    }
}

void *mem_Alloc(MemoryPool *pool, size_t size)
{
    struct chunk *ch;
    void *rv = (void *)pool->free;
    size = (size + pool->alignmask) & ~pool->alignmask;
    if (size <= 0) size = pool->alignmask;
    pool->free += size;
    if (pool->free > pool->end || pool->free < (uintptr_t)rv) {
        size_t minreq = (size + sizeof(struct chunk) + pool->alignmask)
                      & ~pool->alignmask;
        pool->free = (uintptr_t)rv;
        if (minreq >= pool->chunksize) {
            // request size is too big for the chunksize, so allocate it as
            // a single chunk of the right size
            ch = malloc(minreq);
            if (!ch) return 0;
        } else {
            ch = malloc(pool->chunksize);
            if (!ch) return 0;
            pool->free = (uintptr_t)ch + minreq;
            pool->end = (uintptr_t)ch + pool->chunksize;
        }
        ch->next = pool->next;
        pool->next = ch;
        rv = (void *)(((uintptr_t)(ch+1) + pool->alignmask) & ~pool->alignmask);
    }
    return rv;
}

void *mem_Calloc(MemoryPool *pool, size_t size, int count)
{
    void *rv = mem_Alloc(pool, size*count);
    if (rv)
        memset(rv, 0, size*count);
    return rv;
}

void *mem_Realloc(MemoryPool *pool, void *old, size_t oldsize, size_t newsize)
{
    void *new;
    uintptr_t oldfree = 0;

    oldsize = (oldsize + pool->alignmask) & ~pool->alignmask;
    newsize = (newsize + pool->alignmask) & ~pool->alignmask;
    if ((uintptr_t)old + oldsize == pool->free) {
        // this was the last chunk allocated, so deallocate it first
        // but remember in case the later alloc fails...
        oldfree = pool->free;
        pool->free = (uintptr_t)old;
    }
    new = mem_Alloc(pool, newsize);
    if (new) {
        if (new != old) {
            memcpy(new, old, oldsize);
        }
    } else if (oldfree) {
        pool->free = oldfree;
    }
    return new;
}

int mem_AddCleanup(MemoryPool *pool, void (*fn)(void *), void *arg) {
    struct cleanup *cleanup;

    pool->free = (pool->free + sizeof(void *) - 1) & ~(sizeof(void *)-1);
    cleanup = mem_Alloc(pool, sizeof(struct cleanup));
    if (!cleanup) return -1;
    cleanup->next = pool->cleanup;
    cleanup->fn = fn;
    cleanup->arg = arg;
    return 0;
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区国产盗摄色噜噜| av在线播放不卡| 成人毛片视频在线观看| 欧美色男人天堂| 国产精品人人做人人爽人人添| 一区二区在线电影| 成人黄色av网站在线| 欧美一级理论性理论a| 亚洲色图视频网| 成人午夜在线免费| 精品国产污污免费网站入口| 丝袜美腿亚洲综合| 色94色欧美sute亚洲线路一ni| 国产日产欧产精品推荐色| 免费高清在线视频一区·| 色婷婷av一区| 亚洲欧美电影一区二区| 国产成人综合在线播放| 欧美精品一区二区在线观看| 免费观看在线综合色| 欧美精品1区2区3区| 亚洲精品国产无天堂网2021| av不卡免费在线观看| 欧美高清在线一区二区| 狠狠狠色丁香婷婷综合激情| 日韩写真欧美这视频| 亚洲超碰精品一区二区| 欧美系列亚洲系列| 一卡二卡欧美日韩| 欧美在线free| 亚洲国产一二三| 欧美久久久久久久久中文字幕| 亚洲国产美国国产综合一区二区| 色综合久久六月婷婷中文字幕| 国产精品―色哟哟| 成人福利视频网站| 亚洲日本在线视频观看| 在线看国产一区二区| 一区二区三区91| 欧美日韩久久一区| 日韩av电影免费观看高清完整版| 欧美浪妇xxxx高跟鞋交| 奇米一区二区三区| 精品国产成人在线影院 | 亚洲黄色性网站| 色偷偷一区二区三区| 亚洲成人综合在线| 精品国产免费一区二区三区香蕉 | 午夜精品免费在线| 91精品国产综合久久久久久久 | 狠狠色丁香九九婷婷综合五月| 日韩欧美电影在线| 国产不卡免费视频| 亚洲精品中文字幕乱码三区| 欧美片在线播放| 国产乱码精品一区二区三区忘忧草 | 亚洲伦在线观看| 欧美亚洲国产怡红院影院| 日韩制服丝袜av| 国产丝袜欧美中文另类| 91丨porny丨首页| 日韩电影一区二区三区四区| 久久精品欧美日韩| 欧美亚洲丝袜传媒另类| 国产美女精品在线| 亚洲精品一二三区| 精品国产91乱码一区二区三区| 粉嫩av一区二区三区在线播放| 亚洲成人福利片| 国产精品久久久久久久久免费相片| 欧洲国内综合视频| 国产 日韩 欧美大片| 亚洲国产成人精品视频| 国产精品网站在线播放| 制服.丝袜.亚洲.另类.中文| 色综合久久九月婷婷色综合| 日本不卡高清视频| 亚洲黄色片在线观看| 久久亚洲精品小早川怜子| 欧美日韩在线免费视频| www.成人网.com| 韩日欧美一区二区三区| 午夜影院久久久| 亚洲欧美一区二区三区久本道91| 日韩欧美国产wwwww| 欧美在线影院一区二区| 成人av片在线观看| 国产精品综合二区| 毛片av一区二区三区| 亚洲福利电影网| 亚洲色图丝袜美腿| 国产精品久久久久桃色tv| 久久免费视频色| 日韩亚洲欧美一区二区三区| 欧美日韩一区精品| 日本精品裸体写真集在线观看 | **欧美大码日韩| 久久日韩精品一区二区五区| 91精品国产综合久久久久久久| 欧美在线视频全部完| 色综合久久久久久久久| av在线不卡免费看| 成人一级片网址| 成人免费看片app下载| 国产美女视频91| 激情久久五月天| 精品一区二区免费看| 日韩电影在线观看网站| 日韩av一级片| 久久99精品国产91久久来源| 日本三级亚洲精品| 日本91福利区| 久久不见久久见免费视频7| 美女精品一区二区| 免费av成人在线| 蜜桃久久久久久| 另类小说色综合网站| 国产美女视频一区| 成人午夜视频福利| av不卡免费在线观看| 在线视频国内自拍亚洲视频| 欧美日韩亚州综合| 91精品国产综合久久婷婷香蕉| 91精品国产高清一区二区三区蜜臀 | 蜜桃精品视频在线观看| 三级在线观看一区二区| 青青草国产精品97视觉盛宴| 久久成人综合网| 国产91色综合久久免费分享| 不卡的av中国片| 欧美性感一类影片在线播放| 正在播放一区二区| 国产日产欧美一区二区三区 | 久久亚洲免费视频| 国产精品久久久久久久久动漫| 亚洲欧美日韩人成在线播放| 午夜视频一区在线观看| 久久99精品久久久久久久久久久久| 国产福利91精品一区二区三区| 99久久精品一区二区| 在线播放一区二区三区| 2023国产精品| 亚洲一区中文日韩| 久久国产麻豆精品| 91丝袜美腿高跟国产极品老师 | 麻豆成人久久精品二区三区红| 国产一区二区网址| 在线看不卡av| 久久久午夜电影| 亚洲一二三四在线| 国产一区中文字幕| 日本二三区不卡| 欧美精品一区二区久久久| 亚洲欧洲av在线| 久久精品国产澳门| 一本久久综合亚洲鲁鲁五月天 | 风流少妇一区二区| 欧美日韩视频在线一区二区| 久久久精品人体av艺术| 亚洲国产精品久久久男人的天堂| 国产福利一区二区三区视频在线| 欧洲另类一二三四区| 欧美激情综合在线| 美女免费视频一区二区| 欧洲日韩一区二区三区| 国产精品久久影院| 激情另类小说区图片区视频区| 在线观看中文字幕不卡| 亚洲国产精品成人综合| 久久精品国产精品亚洲精品| 欧美日韩一区三区| 亚洲精品欧美专区| 粉嫩aⅴ一区二区三区四区| 精品日韩欧美在线| 日韩av在线发布| 欧美三级乱人伦电影| 亚洲色图欧洲色图婷婷| 成人免费看视频| 国产目拍亚洲精品99久久精品| 日本美女一区二区| 在线播放中文一区| 亚洲大尺度视频在线观看| 一本一道久久a久久精品| 中文字幕中文字幕在线一区| 国产成人av资源| 久久久久久久电影| 国产在线不卡一区| 精品国产凹凸成av人网站| 青青草91视频| 日韩欧美123| 看电视剧不卡顿的网站| 日韩三级在线免费观看| 偷拍亚洲欧洲综合| 91精品国产91热久久久做人人| 亚洲成av人影院在线观看网| 欧美午夜影院一区| 五月激情综合婷婷| 日韩一区二区在线看| 欧美a一区二区| 亚洲精品一区二区在线观看|