![]() |
#1 |
User
Join Date: May 2008
Posts: 241
![]() |
![]() 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 ![]() ![]() Last edited by d07.RiV : 08-08-2008 at 01:29 AM. |
![]() |
![]() |
Sponsored Links - Login to hide this ad! |
|
![]() |
#2 |
obey
|
![]() omg LOL
but no, usefull for hash calculations. |
![]() |
![]() |
![]() |
#3 |
User
Respected User
|
![]() It's usefull, yet the functions are way too slow to give them a true use.
__________________ |
![]() |
![]() |
![]() |
#4 |
User
Join Date: May 2008
Posts: 241
![]() |
![]() 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. |
![]() |
![]() |
![]() |
#5 |
Free Software Terrorist
Technical Director
|
![]() 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. |
![]() |
![]() |
![]() |
#6 |
User
Join Date: May 2008
Posts: 241
![]() |
![]() It is for compatibility with non-vjass users. Just put library..endlibrary and private keyword. Ok I'll split it in 2.
__________________ |
![]() |
![]() |
![]() |
#7 |
User from USSR
|
![]() imho only not and shr/l useful, all another to slow and big)
__________________ |
![]() |
![]() |
![]() |
#8 |
User
Join Date: May 2008
Posts: 241
![]() |
![]() You wanted to use them in 0.04 timers?
__________________Last edited by d07.RiV : 08-06-2008 at 11:21 PM. |
![]() |
![]() |
![]() |
#9 | ||
User from USSR
|
![]() Quote:
Quote:
|
||
![]() |
![]() |
![]() |
#10 |
Free Software Terrorist
Technical Director
|
![]() All right, I am liking the implementations, could you provide benchmarks about the naive "loop through all the bits" implementations?
__________________Approved though. |
![]() |
![]() |
![]() |
#11 |
User
Join Date: May 2008
Posts: 241
![]() |
![]() Ok 4x difference between this and AND of medium sillyness:
__________________![]() |
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
|
|