Added int64 support to the script engine (#4522)

Added support for signed 64 bit integer value computation into the script engine.
This is required because newer official features require support for bigger numbers inside the scripts.

This also cleans up a lot of messy code and fixes a few issues like script stack corruptions.

Thanks to @aleos89 and everyone who supported me with this.
This commit is contained in:
Lemongrass3110
2020-01-13 14:44:48 +01:00
committed by GitHub
parent 3142863a13
commit e72c7360cf
41 changed files with 948 additions and 683 deletions

View File

@@ -2707,6 +2707,22 @@ DBData db_ptr2data(void *data)
return ret;
}
/**
* Manual cast from 'int' to the struct DBData.
* @param data Data to be casted
* @return The data as a DBData struct
* @public
*/
DBData db_i642data(int64 data)
{
DBData ret;
DB_COUNTSTAT(db_i2data);
ret.type = DB_DATA_I64;
ret.u.i64 = data;
return ret;
}
/**
* Gets int type data from struct DBData.
* If data is not int type, returns 0.
@@ -2752,6 +2768,21 @@ void* db_data2ptr(DBData *data)
return NULL;
}
/**
* Gets int64 type data from struct DBData.
* If data is not int64 type, returns 0.
* @param data Data
* @return Integer(64-bit signed) value of the data.
* @public
*/
int64 db_data2i64(DBData *data)
{
DB_COUNTSTAT(db_data2i64);
if (data && DB_DATA_I64 == data->type)
return data->u.i64;
return 0;
}
/**
* Initializes the database system.
* @public