wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Resources > Code Resources > Scripts
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 08-05-2008, 08:48 AM   #1
d07.RiV
User
 
d07.RiV's Avatar
 
Join Date: May 2008
Posts: 241

Submissions (1)

d07.RiV is on a distinguished road (10)

Default Binary integer operations

Implements NOT, AND, OR, XOR, SHL and SHR binary operations (bitwise not, and, or, xor, shift left, shift right)
It find it hard coming up with a real use for it except implementing standard hash methods like crc32 if you ever need them.

To use the non-vjass version, create an integer array called bintable and then either place the system code in trigger called Binary (but there is no way to make sure it can be used by other triggers) or put it in custom script and call InitTrig_Binary from any initialization function.
vJass users probably know what to do, just create a trigger, convert it to text and paste the code.

It builds a table of powers of 2 for shifts, and tables of AND/OR/XOR for all pairs of integers 0..15.
If anyone can think of a way to optimize it significantly (removing an operation or so doesn't count), it would be great.

vJass version
Expand JASS:
Non-vJass version
Expand JASS:
__________________

Last edited by d07.RiV : 08-08-2008 at 01:29 AM.
d07.RiV is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 08-05-2008, 01:44 PM   #2
DioD
obey
 
DioD's Avatar
 
Join Date: Feb 2006
Posts: 1,532

Submissions (4)

DioD is a jewel in the rough (220)DioD is a jewel in the rough (220)DioD is a jewel in the rough (220)DioD is a jewel in the rough (220)

Send a message via ICQ to DioD
Default

omg LOL

but no, usefull for hash calculations.
DioD is offline   Reply With Quote
Old 08-05-2008, 02:07 PM   #3
BlinkBoy
User
 
BlinkBoy's Avatar


Respected User
 
Join Date: Dec 2003
Posts: 835

Submissions (4)

BlinkBoy has a spectacular aura about (97)BlinkBoy has a spectacular aura about (97)BlinkBoy has a spectacular aura about (97)BlinkBoy has a spectacular aura about (97)

Outstanding Tutorial

Default

It's usefull, yet the functions are way too slow to give them a true use.
__________________
Tools:
NeoDex - a Gmax and 3ds Max modeling Toolset for Wc3!

Learn to animate! check out my: Basic Animation Tutorial!

Currently working at a sequel to my animation tutorial.
BlinkBoy is offline   Reply With Quote
Old 08-05-2008, 02:34 PM   #4
d07.RiV
User
 
d07.RiV's Avatar
 
Join Date: May 2008
Posts: 241

Submissions (1)

d07.RiV is on a distinguished road (10)

Default

I cant think of a faster way to do it and its all because blizzards forgot to make these functions ..

But this should be enough for computing crc32 or storm-like hash.
__________________
d07.RiV is offline   Reply With Quote
Old 08-05-2008, 02:36 PM   #5
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,898

Submissions (37)

Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)

Hero Contest #3 - 2nd Place

Default

I might end up banning stuff using udg_ prefixes. Or at least make the vJass version that uses udg_ require to be scoped and the udg_ stuff to be private.

It is a huge regression to use that prefix.
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 08-05-2008, 02:44 PM   #6
d07.RiV
User
 
d07.RiV's Avatar
 
Join Date: May 2008
Posts: 241

Submissions (1)

d07.RiV is on a distinguished road (10)

Default

It is for compatibility with non-vjass users. Just put library..endlibrary and private keyword. Ok I'll split it in 2.
__________________
d07.RiV is offline   Reply With Quote
Old 08-06-2008, 03:11 PM   #7
ADOLF
User from USSR
 
Join Date: Jan 2007
Posts: 127

Submissions (3)

ADOLF will become famous soon enough (36)ADOLF will become famous soon enough (36)

Send a message via ICQ to ADOLF
Default

imho only not and shr/l useful, all another to slow and big)
__________________
ADOLF is offline   Reply With Quote
Old 08-06-2008, 07:34 PM   #8
d07.RiV
User
 
d07.RiV's Avatar
 
Join Date: May 2008
Posts: 241

Submissions (1)

d07.RiV is on a distinguished road (10)

Default

You wanted to use them in 0.04 timers?
__________________

Last edited by d07.RiV : 08-06-2008 at 11:21 PM.
d07.RiV is offline   Reply With Quote
Old 08-07-2008, 09:48 AM   #9
ADOLF
User from USSR
 
Join Date: Jan 2007
Posts: 127

Submissions (3)

ADOLF will become famous soon enough (36)ADOLF will become famous soon enough (36)

Send a message via ICQ to ADOLF
Default

Quote:
You wanted to use them in 0.04 timers
no, but in .025 - maybe)
Quote:
If anyone can think of a way to optimize it significantly
in shifts it is possible to use at once values directly, instead of to take from a array (if it is known at once) ^^
__________________
ADOLF is offline   Reply With Quote
Old 08-07-2008, 11:04 PM   #10
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,898

Submissions (37)

Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)

Hero Contest #3 - 2nd Place

Default

All right, I am liking the implementations, could you provide benchmarks about the naive "loop through all the bits" implementations?

Approved though.
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 08-08-2008, 01:36 AM   #11
d07.RiV
User
 
d07.RiV's Avatar
 
Join Date: May 2008
Posts: 241

Submissions (1)

d07.RiV is on a distinguished road (10)

Default

Ok 4x difference between this and AND of medium sillyness:
Expand JASS:
__________________
d07.RiV is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 12:43 PM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2019, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services