• Welcome to Valhalla Legends Archive.
 

Data Type Education Document

Started by Joe[x86], August 24, 2005, 11:47 PM

Previous topic - Next topic

Joe[x86]

Poke.

I got bored, so I decided to write up a document on data types. Yeah, its rather dry, but I wanted to get it across with no nonsence. If you want to spice it up a bit, feel free to do so. I have a codeheader and code style in my stylesheet, so you can add code blocks if you want (see test.html for example).

If you'd like to host a copy on your server, do something like this.
cd ~/public_html
mkdir datatypes
wget http://www.javaop.com/~joe/datatypes/index.html
wget http://www.javaop.com/~joe/datatypes/test.html
wget http://www.javaop.com/~joe/datatypes/stylesheet.css
Quote from: brew on April 25, 2007, 07:33 PM
that made me feel like a total idiot. this entire thing was useless.

Yegg

You should include Half-word and QuadWord. According to answers.com these are actual Word forms. I think by their name you will know what their value is to be.

Arta


R.a.B.B.i.T

Obviously strings are a series of bytes.  Silly Arta ^^

MyndFyre

Quote from: rabbit on August 25, 2005, 11:49 AM
Obviously strings are a series of bytes.  Silly Arta ^^
Yeah, but different types of strings are different kinds of sequences of bytes.  :P
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

dxoigmn

#5
From the document:

Quote
The Nibble
I am not aware of a nibble being used in Battle.net programming, but for completeness I will discuss it here. A nibble is four bits, half a byte. The biggest nibble is 2^4, or 16.

The large value of a nibble (nybble, however you want to spell it) is 15, not 16. There are, however, 16 possible values for a nibble.

Quote
The Byte
The byte is a single character, 8 bits. Any character is a single byte. The biggest byte possible is 2^8, or 256.

Same as above. The largest value of a byte is 255. There are 256 possible values though. It is not always true that any character is a single byte. That highly depends upon the type of encoding used, unless you're talking about 7-bit ASCII which should be noted then.


Actually, as I look more and more through the document, a lot of the information is wrong about sizes of datatypes.

MyndFyre

#6
Generally, the largest value of data is 2number-of-bits - 1

[edit]Corrected the rather egregious error.  Thanks, Arta![/edit]
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

Arta


Joe[x86]

Thanks everyone. Its been fixed and you've all been credited.

Yegg, I have no experience with a HWORD. I'll look it up later. Seems as if it would be no different than a byte.
Quote from: brew on April 25, 2007, 07:33 PM
that made me feel like a total idiot. this entire thing was useless.

dxoigmn

Quote from: Joex86] link=topic=12613.msg125433#msg125433 date=1125002871]
Thanks everyone. Its been fixed and you've all been credited.

Yegg, I have no experience with a HWORD. I'll look it up later. Seems as if it would be no different than a byte.

The size of your WORD and DWORDS are still wrong. The number of values they can represent are be 2^16 and 2^32, respectively. Subtract one to get the maximum value they can present (if they're unsigned, that is).

R.a.B.B.i.T

Byte booleans aren't seen in the BNCS protocol, and WORD booleans aren't either, only DWORD Booleans are (at least by the common BotDev definitions, where the sizes are all wrong).  A more accurate term for "DWORD Boolean" would be "32-Bit Boolean", however.  Nybble is in there for no reason; it is not used by the BNCS protocol nor by any future definition you present.  A more accurate list:
Unsigned Byte: 7 (ANSI) or 8 (ASCII) bits; value range from 0 - 255 inclusive
HWORD: One half of the WORD-size of the CPU; on a 32-bit system a HWORD is 2 bytes, and on a 64-bit system a HWORD is 4 bytes.
WORD: The standard data size of the CPU; on a 32-bit system a WORD is 4 bytes, and on a 64-bit system a WORD is 8 bytes.
32-Bit Boolean: A 32-bit represenation of 0 or 1.
DWORD: Double the WORD-size of the CPU; on a 32-bit system a DWORD is 8 bytes, and on a 64-bit system a DWORD is 16 bytes.
QWORD: Quadruple the WORD-size of the CPU; on a 32-bit system a QWORD is 16 bytes, and on a 64-bit system it is 64 bytes.

I still say Arta and his crew need to update BnetDocs with the correct information.

Arta

I've never heard 'HWORD' before. That looks like a SHORT to me.

Newby

Nor have I. I have heard of QWORDS, though.
- Newby

Quote[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

Quote<TehUser> Man, I can't get Xorg to work properly.  This sucks.
<torque> you should probably kill yourself
<TehUser> I think I will.  Thanks, torque.

iago

#13
Quote from: dxoigmn on August 25, 2005, 04:07 PM
Quote from: Joex86] link=topic=12613.msg125433#msg125433 date=1125002871]
Thanks everyone. Its been fixed and you've all been credited.

Yegg, I have no experience with a HWORD. I'll look it up later. Seems as if it would be no different than a byte.

The size of your WORD and DWORDS are still wrong. The number of values they can represent are be 2^16 and 2^32, respectively. Subtract one to get the maximum value they can present (if they're unsigned, that is).

The above is correct
QuoteA WORD is not always the same size on all systems, but for the purpose of Battle.net bot development, we will consider it to always be 16 bits, or two bytes. A WORD can be up to 255^2, and coresponds with the BASIC data type Integer, and the C data type short.

A word can be up to 2562-1, or 65525.  It has 2562, or 65536 possible values. 

You'd be better off using the 2x notation. 
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


dxoigmn

Quote from: Newby on August 25, 2005, 04:56 PM
Nor have I. I have heard of QWORDS, though.

QWORDS are quad-words, 64-bits typically. Pertaining to Battle.net, the only place I have seen them used was for a character's experience in Diablo II.