/*
Copyright (c) 2003-2010, Troy D. Hanson http://uthash.sourceforge.net
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef UTHASH_H
#define UTHASH_H
#include <string.h> /* memcmp,strlen */
#include <stddef.h> /* ptrdiff_t */
/* These macros use decltype or the earlier __typeof GNU extension.
As decltype is only available in newer compilers (VS2010 or gcc 4.3+
when compiling c++ source) this code uses whatever method is needed
or, for VS2008 where neither is available, uses casting workarounds. */
#ifdef _MSC_VER /* MS compiler */
#if _MSC_VER >= 1600 && __cplusplus /* VS2010 or newer in C++ mode */
#define DECLTYPE(x) (decltype(x))
#else /* VS2008 or older (or VS2010 in C mode) */
#define NO_DECLTYPE
#define DECLTYPE(x)
#endif
#else /* GNU, Sun and other compilers */
#define DECLTYPE(x) (__typeof(x))
#endif
#ifdef NO_DECLTYPE
#define DECLTYPE_ASSIGN(dst,src) \
do { \
char **_da_dst = (char**)(&(dst)); \
*_da_dst = (char*)(src); \
} while(0)
#else
#define DECLTYPE_ASSIGN(dst,src) \
do { \
(dst) = DECLTYPE(dst)(src); \
} while(0)
#endif
/* a number of the hash function use uint32_t which isn't defined on win32 */
#ifdef _MSC_VER
typedef unsigned int uint32_t;
#else
#include <inttypes.h> /* uint32_t */
#endif
#define UTHASH_VERSION 1.9
#define uthash_fatal(msg) exit(-1) /* fatal error (out of memory,etc) */
#define uthash_malloc(sz) malloc(sz) /* malloc fcn */
#define uthash_free(ptr) free(ptr) /* free fcn */
#define uthash_noexpand_fyi(tbl) /* can be defined to log noexpand */
#define uthash_expand_fyi(tbl) /* can be defined to log expands */
/* initial number of buckets */
#define HASH_INITIAL_NUM_BUCKETS 32 /* initial number of buckets */
#define HASH_INITIAL_NUM_BUCKETS_LOG2 5 /* lg2 of initial number of buckets */
#define HASH_BKT_CAPACITY_THRESH 10 /* expand when bucket count reaches */
/* calculate the element whose hash handle address is hhe */
#define ELMT_FROM_HH(tbl,hhp) ((void*)(((char*)(hhp)) - ((tbl)->hho)))
#define HASH_FIND(hh,head,keyptr,keylen,out) \
do { \
unsigned _hf_bkt,_hf_hashv; \
out=NULL; \
if (head) { \
HASH_FCN(keyptr,keylen, (head)->hh.tbl->num_buckets, _hf_hashv, _hf_bkt); \
if (HASH_BLOOM_TEST((head)->hh.tbl, _hf_hashv)) { \
HASH_FIND_IN_BKT((head)->hh.tbl, hh, (head)->hh.tbl->buckets[ _hf_bkt ], \
keyptr,keylen,out); \
} \
} \
} while (0)
#ifdef HASH_BLOOM
#define HASH_BLOOM_BITLEN (1ULL << HASH_BLOOM)
#define HASH_BLOOM_BYTELEN (HASH_BLOOM_BITLEN/8) + ((HASH_BLOOM_BITLEN%8) ? 1:0)
#define HASH_BLOOM_MAKE(tbl) \
do { \
(tbl)->bloom_nbits = HASH_BLOOM; \
(tbl)->bloom_bv = (uint8_t*)uthash_malloc(HASH_BLOOM_BYTELEN); \
if (!((tbl)->bloom_bv)) { uthash_fatal( "out of memory"); } \
memset((tbl)->bloom_bv, 0, HASH_BLOOM_BYTELEN); \
(tbl)->bloom_sig = HASH_BLOOM_SIGNATURE; \
} while (0);
#define HASH_BLOOM_FREE(tbl) \
do { \
uthash_free((tbl)->bloom_bv); \
} while (0);
#define HASH_BLOOM_BITSET(bv,idx) (bv[(idx)/8] |= (1U << ((idx)%8)))
#define HASH_BLOOM_BITTEST(bv,idx) (bv[(idx)/8] & (1U << ((idx)%8)))
#define HASH_BLOOM_ADD(tbl,hashv) \
HASH_BLOOM_BITSET((tbl)->bloom_bv, (hashv & (uint32_t)((1ULL << (tbl)->bloom_nbits) - 1)))
#define HASH_BLOOM_TEST(tbl,hashv) \
HASH_BLOOM_BITTEST((tbl)->bloom_bv, (hashv & (uint32_t)((1ULL << (tbl)->bloom_nbits) - 1)))
#else
#define HASH_BLOOM_MAKE(tbl)
#define HASH_BLOOM_FREE(tbl)
#define HASH_BLOOM_ADD(tbl,hashv)
#define HASH_BLOOM_TEST(tbl,hashv) (1)
#endif
#define HASH_MAKE_TABLE(hh,head) \
do { \
(head)->hh.tbl = (UT_hash_table*)uthash_malloc( \
sizeof(UT_hash_table)); \
if (!((head)->hh.tbl)) { uthash_fatal( "out of memory"); } \
memset((head)->hh.tbl, 0, sizeof(UT_hash_table)); \
(head)->hh.tbl->tail = &((head)->hh); \
(head)->hh.tbl->num_buckets = HASH_INITIAL_NUM_BUCKETS; \
(head)->hh.tbl->log2_num_buckets = HASH_INITIAL_NUM_BUCKETS_LOG2; \
(head)->hh.tbl->hho = (char*)(&(head)->hh) - (char*)(head); \
(head)->hh.tbl->buckets = (UT_hash_bucket*)uthash_malloc( \
HASH_INITIAL_NUM_BUCKETS*sizeof(struct UT_hash_bucket)); \
if (! (head)->hh.tbl->buckets) { uthash_fatal( "out of memory"); } \
memset((head)->hh.tbl->buckets, 0, \
HASH_INITIAL_NUM_BUCKETS*sizeof(struct UT_hash_bucket)); \
HASH_BLOOM_MAKE((head)->hh.tbl); \
(head)->hh.tbl->signature = HASH_SIGNATURE; \
} while(0)
#define HASH_ADD(hh,head,fieldname,keylen_in,add) \
HASH_ADD_KEYPTR(hh,head,&add->fieldname,keylen_in,add)
#define HASH_ADD_KEYPTR(hh,head,keyptr,keylen_in,add) \
do { \
unsigned _ha_bkt; \
(add)->hh.next = NULL;
没有合适的资源?快使用搜索试试~ 我知道了~
iOS实例开发源码——iOS-Gamer-Cocos2D-86714e3.zip
共471个文件
h:233个
m:199个
png:16个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 123 浏览量
2023-07-02
15:12:06
上传
评论
收藏 1.38MB ZIP 举报
温馨提示
iOS实例开发源码——iOS-Gamer-Cocos2D-86714e3.zip
资源推荐
资源详情
资源评论
收起资源包目录
iOS实例开发源码——iOS-Gamer-Cocos2D-86714e3.zip (471个子文件)
glu.c 3KB
glu.c 3KB
base64.c 2KB
base64.c 2KB
ccUtils.c 364B
ccUtils.c 364B
LICENSE.cocos2d 1KB
LICENSE.cocos2d 1KB
LICENSE.cocosdenshion 1KB
LICENSE.cocosdenshion 1KB
.gitignore 204B
.gitignore 10B
uthash.h 63KB
uthash.h 63KB
utlist.h 36KB
utlist.h 36KB
CCNode.h 17KB
CCNode.h 17KB
CocosDenshion.h 14KB
CocosDenshion.h 14KB
CCCompatibility.h 14KB
CCCompatibility.h 14KB
CCParticleSystem.h 14KB
CCParticleSystem.h 14KB
CCMenuItem.h 13KB
CCMenuItem.h 13KB
CCSprite.h 13KB
CCSprite.h 13KB
CCActionInterval.h 13KB
CCActionInterval.h 13KB
ccCArray.h 12KB
ccCArray.h 12KB
CCTexture2D.h 11KB
CCTexture2D.h 11KB
CCDirectorIOS.h 11KB
CCDirectorIOS.h 11KB
ccConfig.h 10KB
ccConfig.h 10KB
CCDirector.h 9KB
CCDirector.h 9KB
CCLayer.h 9KB
CCLayer.h 9KB
CDAudioManager.h 9KB
CDAudioManager.h 9KB
ccMacros.h 8KB
ccMacros.h 8KB
CCTransition.h 8KB
CCTransition.h 8KB
CCEventDispatcher.h 8KB
CCEventDispatcher.h 8KB
CGPointExtension.h 8KB
CGPointExtension.h 8KB
EAGLView.h 7KB
EAGLView.h 7KB
CCActionGrid3D.h 7KB
CCActionGrid3D.h 7KB
CCActionTiledGrid.h 7KB
CCActionTiledGrid.h 7KB
CCScheduler.h 6KB
CCScheduler.h 6KB
CCSpriteBatchNode.h 6KB
CCSpriteBatchNode.h 6KB
ccTypes.h 6KB
ccTypes.h 6KB
CCTMXLayer.h 6KB
CCTMXLayer.h 6KB
CCTMXXMLParser.h 6KB
CCAction.h 6KB
CCTMXXMLParser.h 6KB
CCAction.h 6KB
CCActionEase.h 6KB
CCActionEase.h 6KB
CCLabelBMFont.h 6KB
CCLabelBMFont.h 6KB
CCTMXTiledMap.h 5KB
CCTMXTiledMap.h 5KB
CCTextureCache.h 5KB
CCTextureCache.h 5KB
CCActionGrid.h 5KB
CCActionGrid.h 5KB
CCTextureAtlas.h 5KB
CCTextureAtlas.h 5KB
CCActionInstant.h 5KB
CCActionInstant.h 5KB
CCSpriteFrameCache.h 5KB
CCSpriteFrameCache.h 5KB
CCAnimation.h 5KB
CCAnimation.h 5KB
OpenGL_Internal.h 4KB
OpenGL_Internal.h 4KB
cocos2d.h 4KB
cocos2d.h 4KB
CLScoreServerRequest.h 4KB
CLScoreServerRequest.h 4KB
CLScoreServerPost.h 4KB
CLScoreServerPost.h 4KB
CCTouchDispatcher.h 4KB
CCTouchDispatcher.h 4KB
CCActionManager.h 4KB
CCActionManager.h 4KB
共 471 条
- 1
- 2
- 3
- 4
- 5
资源评论
快乐无限出发
- 粉丝: 1126
- 资源: 7260
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功