mIRC Home    About    Download    Register    News    Help

Print Thread
#109245 27/01/05 01:35 AM
Joined: Oct 2003
Posts: 29
I
iRP Offline OP
Ameglian cow
OP Offline
Ameglian cow
I
Joined: Oct 2003
Posts: 29
I think it would be great if mIRC could do << and >> conversions through its calculator or in a function. Ex: 199 >> 16


Good job Khaled for 140,100+ lines of source code!!!
#109246 27/01/05 11:54 AM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
Why not just multiply/divide by a power of 2? Bitshifting in such a high-level language won't offer any performance gains, if that's what you want it for.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
#109247 01/02/05 03:23 AM
Joined: Aug 2003
Posts: 72
V
Babel fish
Offline
Babel fish
V
Joined: Aug 2003
Posts: 72
bitshifting with << >> is more leet wink

joking

#109248 01/02/05 04:42 AM
Joined: Mar 2004
Posts: 540
A
Fjord artisan
Offline
Fjord artisan
A
Joined: Mar 2004
Posts: 540
*sigh*

#109249 01/02/05 05:19 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
[just tacked onto the bottom of the thread]

alias << { if ($1 isnum) && ($2 isnum) { return $floor($calc($1 * (2 ^ ($abs($2))))) } | return $1 }
alias >> { if ($1 isnum) && ($2 isnum) { return $floor($calc($1 / (2 ^ ($abs($2))))) } | return $1 }


Just for all those who want to be leet LOL

//echo -a $$<<(129,2) $$>>(129,2)
516 32


PS: im sure it can be broken without much effort.

#109250 01/02/05 05:58 PM
Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
how about
Code:
alias &lt;&lt; { return $base($base($$1,10,2) $+ $str(0,$$2),2,10) }
alias &gt;&gt; { return $base($left($base($$1,10,2),$+(-,$$2)),2,10) }


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
#109251 01/02/05 10:21 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
//echo -a $>>(129,0) frown

#109252 02/02/05 04:53 AM
Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
i didnt put that much effort into it, sorry.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
#109253 06/02/05 07:04 AM
Joined: Jan 2003
Posts: 87
T
Tat Offline
Babel fish
Offline
Babel fish
T
Joined: Jan 2003
Posts: 87
I agree. But the << and >> are pretty high language so no performance gains. Although for visualing it actually would be very helpful. Why you just multiplied by 2 when you wanted to shift every bit to the left seems odd. Anybody who doesn't grasp this feature of binary would be kinda freaked out.

I want *ALL* bitwise operations in $calc.

I tried $calc($1 & 7) once and got driven nuts.

//echo ... $calc(34 & 7)

I bugchecked for twenty minutes. I never doubted basic functions would be missing from $calc. And it worked for everything below 7. Took a while to find out you can't do a bitwise and, and how the heck you do a bitwise and.

I searched and searched, and finally came across $and()

What a joke! Add the stupid bitwise operators into calc. Not just << and >>... All of them.

^ is typically used for xor and used as power in $calc so something has to be done. Typically ** is the power function in other languages that have it natively. Because of backwards compatabilly making ^ into xor wouldn't be doable.

Nevertheless, $calc needs ALL bitwise operations!


Link Copied to Clipboard