Raised This Month: $ Target: $400
 0% 

How to safely set all bits in a bitflag?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
danielkza
AMX Mod X Plugin Approver
Join Date: May 2007
Location: São Paulo - Brasil
Old 01-22-2009 , 15:11   How to safely set all bits in a bitflag?
Reply With Quote #1

I need to return a bitflag with all bits set. My first thought was to set it to '0xFFFFFFFF'. But then I realized in AMD64 cells have 64 bits. I'm not sure if this would set the most or the least significant bits. And unfortunately I don't have a 64bit processor to test it.

Would this work?

Code:
#if cellbits==32
    return 0xFFFFFFFF
#else
    return 0xFFFFFFFFFFFFFFFF
#endif
__________________

Community / No support through PM
danielkza is offline
jim_yang
Veteran Member
Join Date: Aug 2006
Old 01-23-2009 , 02:36   Re: How to safely set all bits in a bitflag?
Reply With Quote #2

signed value for all bits set is -1
or ~0 for unsure case (unsigned or signed)
__________________
Project : CSDM all in one - 99%
<team balancer#no round end#entity remover#quake sounds#fake full#maps management menu#players punishment menu#no team flash#colored flashbang#grenade trails#HE effect#spawn protection#weapon arena#weapon upgrade#auto join#no weapon drop#one name>
jim_yang 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 01:39.


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