• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Snippet] BitInt

This is completely different from BigInt ; )

bits are written, so you don't multiply and add like you did before, you just write bits

because bits are written, the size is going to bloat a bit. The multiply in BigInt lets you store with maximal accuracy, down to fractions of bits. When you just use bits directly, you lose that accuracy, thus bloat. However, BitInt is MUCH faster than BigInt and as such can handle MUCH more data w/o freezing or thread crashing. The operation magnitudes are also independent from the number of bits in a BitInt, unlike BigInt, whose operations grow as the BigInt grows.

You want to use BigInt when you are dealing with standard save/load codes and BitInt when you are doing save/load with networking.
 
Thanks for the quick explanation.
You want to use BigInt when you are dealing with standard save/load codes and BitInt when you are doing save/load with networking.
... hmm, so basicly this only makes sense when used in combination with hostbots or website-hosted games?
 
Added 4 new methods
JASS:
*           //dangerous, read note
*           method pushFront takes BitInt bits returns nothing
*               -   Pushes bits on to front of this
*               -   Can push on to partials, but can't push parials
*               -   A BitInt is partial if bitCount%bitGroup != 0
*
*           //dangerous, read note
*           method pushBack takes BitInt bits returns nothing
*               -   Pushes bits on to back of this
*               -   Can push partials, but can't push on to partials
*               -   A BitInt is partial if bitCount%bitGroup != 0
*
*           method popFront takes integer nodeCount returns BitInt
*               -   Pops off front nodes and returns BitInt containing them
*
*           method popBack takes integer nodeCount returns BitInt
*               -   Pops off back nodes and returns BitInt containing them
 
Level 5
Joined
Jun 26, 2013
Messages
49
math? no, never heard...

Code:
// cJass
#define IntGetByte1(src) = (src / (256*256))
#define IntGetByte2(src) = (ModuloInteger(src, (256*256)) / 256)
#define IntGetByte3(src) = (ModuloInteger(src,256))
#define IntSetByte1(src,val) = { src = (ModuloInteger(src,(256*256)) + val*256*256 ) }
#define IntSetByte2(src,val) = { src = (ModuloInteger(src,256) + (src / (256*256))*256*256 + val*256) }
#define IntSetByte3(src,val) = { src = ((src / 256)*256 +val)}

Hello from Russia
 
math? no, never heard...

Code:
// cJass
#define IntGetByte1(src) = (src / (256*256))
#define IntGetByte2(src) = (ModuloInteger(src, (256*256)) / 256)
#define IntGetByte3(src) = (ModuloInteger(src,256))
#define IntSetByte1(src,val) = { src = (ModuloInteger(src,(256*256)) + val*256*256 ) }
#define IntSetByte2(src,val) = { src = (ModuloInteger(src,256) + (src / (256*256))*256*256 + val*256) }
#define IntSetByte3(src,val) = { src = ((src / 256)*256 +val)}

Hello from Russia

That's not relevant to this resource and the use of ModuloInteger would get us closer to the operation-limit. (Meaning MD5 and AES wouldn't work well :v)
Also, that code has the wrong behavior for negative numbers.
 
Level 5
Joined
Jun 26, 2013
Messages
49
That's not relevant to this resource and the use of ModuloInteger would get us closer to the operation-limit. (Meaning MD5 and AES wouldn't work well :v)
Also, that code has the wrong behavior for negative numbers.

I didn't create SetByte4 but you can if you want, this is not too difficult.

To solve oplimit you can use 1 periodic timer with custom stack (ExecuteFunc leads to desync, tested), this is not a problem at all.
 
Level 5
Joined
Jun 26, 2013
Messages
49
Magtheridon96, ok, I meant the oplimit resolution should be incapsulated into MD5 system and you can call MD5 without worrying about threads.

Nestharus, the question is in perfomance of your overheaded OO according binary operations. Nobody in pro dev does such kinda things. But in pro langs there are good optimizators and directives (like marco and inline) for such kinda calls, what I cannot say about vjass =)
 
Top