Sign in to follow this  
jkhax0r

Change in Angelscript OR operator behavior

Recommended Posts

I'm sure there's an explanation for this. I had some code that used the '|' (or) operator to join two bytes into a 16 bit value. I recently upgraded from a version that was about 1 year old to V2.14 and it seems something has changed. Here is a simplified case to reproduce what I am seeing. Basically, the code that joins the bytes using '+' and using '|' used to do the exact same thing, but now the '|' doesn't seem to work right.
Quote:
uint16 Z1; uint8 b1 = 2; uint8 b2 = 2; string str; //Using '+' Z1 = (b1 & 0x00FF) + ((b2 << 8) & 0xFF00); b1 = Z1 & 0x00FF; b2 = (Z1 >> 8) & 0x00FF; str = "First Run - b1=" + b1 + " b2=" + b2 + "\n"; //Using '|' Z1 = (b1 & 0x00FF) | ((b2 << 8) & 0xFF00); b1 = Z1 & 0x00FF; b2 = (Z1 >> 8) & 0x00FF; str += "Second Run - b1=" + b1 + " b2=" + b2 + "\n";
and the output in str is
Quote:
First Run - b1=2 b2=2 Second Run - b1=2 b2=0
Thanks in advance.

Share this post


Link to post
Share on other sites
I wrote all the functions for scriptfile.cpp and scriptfile.h trying to follow your style as much as possible.

I wanted to offer this code to you as a means to help contribute. Let me know if you are interested and I'll send it your way.

Share this post


Link to post
Share on other sites

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