Jump to content
  • Advertisement
Sign in to follow this  
Trikko

About bitfield

This topic is 4024 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello! I need to do some bit operation on an integer. Is it possible? I pass a bitfield to an angelscript function as integer, do any bit-to-bit logical operator exist? Are "or" "and" only for boolean type on angelscript (it seems they won't work as expected on my int)?

Share this post


Link to post
Share on other sites
Advertisement
Ok I was wrong. Bitwise operator works, there was an error on some const definitions.

By the way now it complains about this:

bool action_on_contact(int o1, int contactType)
{
if (!(contactType & CONTACT_START == CONTACT_START)) return true;
...
...
}

It shows this warning: Signed/Unsigned mismatch.

contactType is an int. CONTACT_START is defined as const int CONTACT_START = 2

Is the problem the sign-bit on bitwise operations? Can't I suppress this warning?

Share this post


Link to post
Share on other sites
Bitwise operations currently result in unsigned integer values, that's why you get this warning. I'll see if I can change this in a future version, so that the type is maintained, just like it is in C++.

You can either do a cast to integer, or you can suppress the warning in your message handler, just check if the message is this warning and don't display it.

Regards,
Andreas

Share this post


Link to post
Share on other sites
I've updated the library to maintain the signed/unsigned type of the left operand now. It's currently available in the SVN (revision 200), and will be available officially with 2.10.0.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!