CScriptArray::Equals doesn't know about 64-bit types

Started by
3 comments, last by WitchLord 2 years, 6 months ago
	uint64 zero = 0;
    uint64 nonzero = 0x100000000;
    array<uint64> array_zero = {zero};
    array<uint64> array_nonzero = {nonzero};
    print("" + (zero == nonzero)); //false, good
    print("" + (array_zero == array_nonzero)); //true, but should be false
    print("" + array_nonzero.find(zero)); //0, but should be -1

As far as I know arrays of 64-bit types are okay otherwise, it's just these two contexts that use the internal Equals method that are behaving improperly.

Advertisement

Thanks for the report. I'll investigate and fix this.

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

Violet CLM said:

As far as I know arrays of 64-bit types are okay otherwise

Ah, actually, sorting also gets confused:

array<uint64> arr = {0, 2, 4, 0x100000001, 0x100000003, 0x100000005 };
arr.sortAsc();
for (uint i = 0; i < arr.length; ++i)
	print(formatInt(arr[i], "H"));

This prints, in order: 0, 100000001, 2, 100000003, 4, 100000005.

I've fixed these problems in rev 2753.

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

This topic is closed to new replies.

Advertisement