什么是`16 longs`的含义和`110 words`,当从文件中读取所述位 [英] What is the meaning of `16 longs` and `110 words`, when reads the bits from a file
问题描述
我想读 PUD
文件格式,属于魔兽争霸2
游戏地图。
在文件结构的解释,有小的短语我不明白它。
这是什么意思( 16多头
, 110字
)的 ?
下面是一个例子
16多头------->单位和允许的建筑。 (16名球员)
块引用>台位顺序:
0000000000000000000000000000000x位0:男仆/咕噜
000000000000000000000000000000x0第1位:农民/苦工
00000000000000000000000000000x00位2:弩车/弹射器
0000000000000000000000000000x000位3:骑士/食人魔
000000000000000000000000000x0000位4:弓箭手/投掷斧
00000000000000000000000000x00000位5:法师/死亡骑士
0000000000000000000000000x000000位6:油轮
000000000000000000000000x0000000第7位:驱逐舰
00000000000000000000000x00000000位8:运输
0000000000000000000000x000000000 BIT9:战舰/ juggernault
000000000000000000000x0000000000位10:潜水艇/乌龟
00000000000000000000x00000000000 11位:飞行机/气球
0000000000000000000x000000000000位12:狮鹫/龙
000000000000000000x0000000000000位13:未使用/未使用
00000000000000000x00000000000000位14:演示。班/工兵
0000000000000000x000000000000000位15:鸟舍/称雄
000000000000000x0000000000000000位16:农场
00000000000000x00000000000000000 BIT17:兵营
0000000000000x000000000000000000 bit18:木材厂
000000000000x0000000000000000000 bit19:马厩/丘
00000000000x00000000000000000000故障Bit20:法师塔/寺庙
0000000000x000000000000000000000 bit21:代工
000000000x0000000000000000000000 bit22:炼油厂
00000000x00000000000000000000000 bit 23为1:发明人/炼金术士
0000000x000000000000000000000000 bit24:教堂/坛风暴
000000x0000000000000000000000000 bit25:塔
00000x00000000000000000000000000 bit26:市政厅/人民大会堂
0000x000000000000000000000000000 bit27:保留/据点
000x0000000000000000000000000000 bit28:城堡/要塞
00x00000000000000000000000000000位29:铁匠
0x000000000000000000000000000000的bit30:造船厂
x0000000000000000000000000000000位31:未使用这意味着
16多头
=16 * 4字节= 64
或16 * 32位= 512
或其它。结果
也有同样的事情110字
。解决方案他们指的是C型上的特定结构。在C,
长
是一个类型的变量。其大小而作为编译器的功能,但在这种情况下,它是一个32位的值。话是处理器的话,这是典型的现代的说法32位。然而,魔兽争霸2是很久以前写的,运行在16位机器。肖恩在评论中指出的,字是16位,在这种情况下。要回答这个问题在注释:
16多头= 16 * 32位= 512位= 64个字节。
110个字= 110 * 16位= 1760比特= 220字节。
I'm trying to read
PUD
file format, that belong to thewarcraft 2
game map.In the explanation of file structure, there is small phrases I don't understand it.
What is this mean (
16 longs
,110 words
) ?Here is an example
16 longs -------> Units and buildings allowed. (16 players)
units bit order: 0000000000000000000000000000000x bit0: footman/grunt 000000000000000000000000000000x0 bit1: peasant/peon 00000000000000000000000000000x00 bit2: ballista/catapult 0000000000000000000000000000x000 bit3: knight/ogre 000000000000000000000000000x0000 bit4: archer/axe thrower 00000000000000000000000000x00000 bit5: mage/death knights 0000000000000000000000000x000000 bit6: tanker 000000000000000000000000x0000000 bit7: destroyer 00000000000000000000000x00000000 bit8: transport 0000000000000000000000x000000000 bit9: battleship/juggernault 000000000000000000000x0000000000 bit10: submarine/turtle 00000000000000000000x00000000000 bit11: flying machine/balloon 0000000000000000000x000000000000 bit12: gryphon/dragon 000000000000000000x0000000000000 bit13: unused/unused 00000000000000000x00000000000000 bit14: demo. squad/sapper 0000000000000000x000000000000000 bit15: aviary/roost 000000000000000x0000000000000000 bit16: farm 00000000000000x00000000000000000 bit17: barracks 0000000000000x000000000000000000 bit18: lumber mill 000000000000x0000000000000000000 bit19: stables/mound 00000000000x00000000000000000000 bit20: mage tower/temple 0000000000x000000000000000000000 bit21: foundry 000000000x0000000000000000000000 bit22: refinery 00000000x00000000000000000000000 bit23: inventor/alchemist 0000000x000000000000000000000000 bit24: church/altar storms 000000x0000000000000000000000000 bit25: tower 00000x00000000000000000000000000 bit26: town hall/great hall 0000x000000000000000000000000000 bit27: keep/stronghold 000x0000000000000000000000000000 bit28: castle/fortress 00x00000000000000000000000000000 bit29: blacksmith 0x000000000000000000000000000000 bit30: shipyard x0000000000000000000000000000000 bit31: unused
Is this mean
16 longs
=16*4Bytes = 64
or16*32Bits = 512
or other.
Also the same thing with110 words
.解决方案They're referring to C types on a particular architecture. In C,
long
is a type of variable. Its size varies as a function of the compiler, but in this case it's a 32-bit value. Words are processor words, which are typically 32 bits in modern parlance. However, Warcraft 2 was written a long time ago and runs on 16-bit machines. As Sean pointed out in a comment, words are 16 bits in this context.To answer the question in the comment:
16 longs = 16 * 32 bits = 512 bits = 64 bytes.
110 words = 110 * 16 bits = 1760 bits = 220 bytes.
这篇关于什么是`16 longs`的含义和`110 words`,当从文件中读取所述位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!