Raised This Month: $ Target: $400
 0% 

Bits (results -1)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Xalus
Veteran Member
Join Date: Dec 2009
Location: Belgium
Old 04-24-2013 , 07:53   Bits (results -1)
Reply With Quote #1

Hey,

For the weaponsystem I'm making for Dimensions,
I'm trying to get the result of:

PHP Code:
( (<< 0) | (<< 1) | (<< 2) | (<< 3) | (<< 4) | (<< 5) | (<< 6) | (<< 7) | (<< 8) | (<< 9) | (<< 10) | (<< 11) | (<< 12) | (<< 13) | (<< 14) | (<< 15) | (<< 16) | (<< 17) | (<< 18) | (<< 19) | (<< 20) | (<< 21) | (<< 22) | (<< 23) | (<< 24) | (<< 25) | (<< 26) | (<< 27) | (<< 28) | (<< 29) | (<< 30) | (<< 31) ) 
But it returns -1

Whats wrong with it
__________________
Retired.
Xalus is offline
Xalus
Veteran Member
Join Date: Dec 2009
Location: Belgium
Old 04-24-2013 , 08:07   Re: Bits (results -1)
Reply With Quote #2

Looks like 1<<31 was to much for PAWN

Solved ;)
__________________
Retired.
Xalus is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-24-2013 , 08:28   Re: Bits (results -1)
Reply With Quote #3

It's because you use %d/%i instead of %u (unsigned) (so unrelated to 1 << 31 itself)

And to get such value, you can do : ~( 1 << 32 ) + 1.
__________________

Last edited by Arkshine; 04-24-2013 at 08:31.
Arkshine is offline
Xalus
Veteran Member
Join Date: Dec 2009
Location: Belgium
Old 04-24-2013 , 11:01   Re: Bits (results -1)
Reply With Quote #4

Aight,

Thanks!
__________________
Retired.
Xalus is offline
Reply



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

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

Forum Jump


All times are GMT -4. The time now is 10:46.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode