Advertisement

some suggestion about shift instruction!

Started by April 10, 2008 02:18 AM
3 comments, last by loboWu 16 years, 7 months ago
Ther is a big difference between AngelScript and VC about shit operation. For a example: uint8[] buf={1,2,3,4,5,6}; uint32 version; version = buf[0]<<24; <<== AS won't expand to uint32, so version is 0 version |= buf[1]<<16; version |= buf[2]<<8; version |= buf[3]; In VC, it will expand uint8 to uint32, so the version=0x01020304; buf in AS, version=0x00000004; Could it be possible to expand type when operator of shit instruction is larger than 8 ? Thanks a lot.
use cast<uint>() ?

I do not try to do this :)
Advertisement
I think you may have discovered a bug in AngelScript. The shift operators should indeed result in 32bit integers if the left operand is <= 32bit.

I'll investigate this tomorrow.

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

It was indeed a bug, one that I've fixed now. The correction is available in SVN revision 255.

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

Thanks.
I will check the SVN

This topic is closed to new replies.

Advertisement