Advertisement

Change in Angelscript OR operator behavior

Started by December 19, 2008 04:22 AM
4 comments, last by WitchLord 15 years, 10 months ago
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.
This must be a bug that has managed to creep into the code. What version were you using before you upgraded to 2.14?

I'll have this fixed as soon as I get home from my vacation (in January).

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Advertisement
Current version with bug: 2.14.1
Previous version that used to work with the '|' operator: 2.8.0a

Thanks for the awesome scripting library!
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.
I am indeed interested. If you can send it to my e-mail andreas@angelcode.com I'd be grateful.

Regards,
Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

I've fixed this bug now. You can get the fix from the SVN.

Thanks,
Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement