Sign in to follow this  

About bitfield

This topic is 3736 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
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

This topic is 3736 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this