找回密码
 点一下
查看: 1732|回复: 25

WE的新变革,returnbug+GC的末日到来了?

[复制链接]
发表于 2009-6-10 22:34:39 | 显示全部楼层 |阅读模式
1.23b貌似会增加利用hash表存取数据的方法

http://forums.battle.net/thread.html?topicId=17730193178
发表于 2009-6-10 22:51:32 | 显示全部楼层
哇。。。。。。。。
回复

使用道具 举报

发表于 2009-6-10 22:52:23 | 显示全部楼层
While the original GameCache JASS functions only allowed units and JASS primitives to be stored (Integer, Real, Boolean, and String), hashtables can store most JASS handle types. However unlike the GameCache which uses strings for keys, the hashtable uses integers. Additionally, storing and retrieving data in hashtables are much faster and safer than storing data in the GameCache.

The new functions GetHandleId and StringHash are to assist in turning either a handle or a string into an integer. This indirectly allows handles and strings to be used as hashtable keys.


MS所有的研究都没用了
像缓存一样使用,可以直接存储多种handle
回复

使用道具 举报

发表于 2009-6-10 23:07:22 | 显示全部楼层
j盲过路..
回复

使用道具 举报

发表于 2009-6-10 23:12:09 | 显示全部楼层
sc2很快就来了……忘记we吧……
回复

使用道具 举报

发表于 2009-6-10 23:13:37 | 显示全部楼层
唉唉,看来ret bug+GC真的要结束了,新的数据结构似乎也将失去大部分意义了……
好不舍……
回复

使用道具 举报

发表于 2009-6-11 00:11:39 | 显示全部楼层
returnbug是啥?

H2I 系列的算么?
回复

使用道具 举报

发表于 2009-6-11 00:49:12 | 显示全部楼层
H2I是return bug的实例
回复

使用道具 举报

发表于 2009-6-11 01:04:36 | 显示全部楼层
StringHash 是什么用途说得根本不清楚

However unlike the GameCache which uses strings for keys, the hashtable uses integers.
ReturnBug应该还有用吧,要不拿什么来作为keys

In order to reduce the number of JASS naming conflicts with existing maps, we named the function GetHandleId.很欣赏这句
回复

使用道具 举报

发表于 2009-6-11 01:07:21 | 显示全部楼层
hmmm,那个GetHandleId是什么用的呢?没仔细看
回复

使用道具 举报

发表于 2009-6-11 01:09:40 | 显示全部楼层
其实就是H2I,因为现在地图都用滥了,为了避免函数命名冲突和现在的地图兼容,所以叫GetHandleId
回复

使用道具 举报

 楼主| 发表于 2009-6-11 01:15:16 | 显示全部楼层
我猜StringHash应该是这样
function StringHash takes string s returns integer
它应该就是一个hash函数吧,计算一个字符串的hash值。

GetHandleId貌似就是H2I,暴雪把它变成CJ函数了
回复

使用道具 举报

发表于 2009-6-11 01:17:28 | 显示全部楼层
既然就是H2I,那么return bug也就没有必要了吧……
回复

使用道具 举报

发表于 2009-6-11 01:18:08 | 显示全部楼层
哦对了,可以说ReturnBug不需要了,因为GetHandleId是本地函数了
回复

使用道具 举报

发表于 2009-6-11 01:19:38 | 显示全部楼层
引用第11楼actboy168于2009-06-11 01:15发表的  :
我猜StringHash应该是这样
function StringHash takes string s returns integer
它应该就是一个hash函数吧,计算一个字符串的hash值。

GetHandleId貌似就是H2I,暴雪把它变成CJ函数了
如果是计算一个字符串的值,应该不会说类似S2I,难道说数字串的HASH值等于S2I值?
回复

使用道具 举报

 楼主| 发表于 2009-6-11 01:22:18 | 显示全部楼层
StringHash takes a string and returns an integer much like S2I

他的意思应该是StringHash声明和S2I一样吧"takes a string and returns an integer"
回复

使用道具 举报

发表于 2009-6-11 01:25:14 | 显示全部楼层
S2I是类似java中Integer.parseInt这样的方法
按lz的猜想,StringHash是类似于H2I的一个方法,但是对象是String,获取在hashtable中的index?
回复

使用道具 举报

 楼主| 发表于 2009-6-11 01:34:16 | 显示全部楼层
StringHash和hashtable没什么联系啊,就是一纯粹的hash函数,比如这样
  1. int StringHash(char* str, int len)
  2. {
  3.   return str[0]*2047*2047+str[len/2]*2047+str[len-1];
  4. }
复制代码

SaveXHandle是用integer作为key的,所以暴雪提供了各种变量到integer的转换吧,这应该是StringHash和GetHandleId这两个函数的作用
回复

使用道具 举报

发表于 2009-6-11 01:38:15 | 显示全部楼层
唉唉,数据结构学得好差,根本不记得学过hash这样的东西,虽然记得考试考过……
什么时候要好好补习下了………………
回复

使用道具 举报

发表于 2009-6-11 01:41:09 | 显示全部楼层
那1.23b什么时候出来啊
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 点一下

本版积分规则

Archiver|移动端|小黑屋|地精研究院

GMT+8, 2024-9-30 01:27 , Processed in 0.035213 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表