XOR in JASS ?

Ghan

Administrator - Servers are fun
Staff member
Reaction score
888
I don't think so.... You could always try it and see. :D
 

Cohadar

master of fugue
Reaction score
209
:( I don't need functions,

I was asking for operators because I wanted to optimize something....

I hate JASS :banghead:
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
888
> I hate JASS

But you're so good at it. :p (I really mean that, not sarcastically.)
 

Cohadar

master of fugue
Reaction score
209
I would be 10 times better if it was a REAL programming language.

Sometimes I feel like working in QBASIC
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
888
> Sometimes I feel like working in QBASIC

You were way beyond me in JASS, let alone another language. :p (Sorry if this is getting too off-topic.)
 

Cohadar

master of fugue
Reaction score
209
Nice job by phyrex1an.

Yes those are right functions.

If JASS was written properly we would have them built in in the language.
If only JASS had an asm{} command :)
 
S

suncowiam

Guest
Nice job by phyrex1an.

Yes those are right functions.

If JASS was written properly we would have them built in in the language.
If only JASS had an asm{} command :)

I hear ya. Things could have been so much easier with bitwise operators.
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
The good news is: the "mod" function is much faster than any looping you would be doing "by hand".

Is that part any speed-critical?
I take it the basic "if greater, subtract" doesn't do it?
 

Cohadar

master of fugue
Reaction score
209
Of course it is speed critical, I would not be asking for xor if it... njaaaaaaah

this is how blizzard does mod:
Code:
function ModuloInteger takes integer dividend, integer divisor returns integer
    local integer modulus = dividend - (dividend / divisor) * divisor

    // If the dividend was negative, the above modulus calculation will
    // be negative, but within (-divisor..0).  We can add (divisor) to
    // shift this result into the desired range of (0..divisor).
    if (modulus < 0) then
        set modulus = modulus + divisor
    endif

    return modulus
endfunction

With is kind of strange considering that mod is build it
in every CPU on every computer on this planet
and exist in every programming language except JASS.

Seems like JASS has been designed by someone who completed
a "microsoft certificate" curs for programmers.

EDIT:

About the mission-critical,
I need mod for this.
Code:
//------------------------------------------------------------------------------
// attaches integer to a handle by using hash table
//------------------------------------------------------------------------------
function Set$NAME$$X$ takes handle h, handle s returns nothing
    local integer startingHash
	local integer i = ABC_H2I(h)  // hashkey
    
	set i = i - (i / HASH_SIZE) * HASH_SIZE  // mod(hashkey, HASH_SIZE)
        
    if (Value$NAME$$X$[i] == null) then
        set Value$NAME$$X$[i] = s
        set Key$NAME$$X$[i] = h
        return
    else

Note that this code almost never gets past else statement.
And when I say almost never I really mean it,
it happens max 10 times in 1 hour long game.

Anyways in case somebody didn't notice this:
http://www.thehelper.net/forums/showthread.php?t=62846
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top