About bitfield
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)?
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?
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?
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
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
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement