1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-01-31 09:57:14 +01:00

More helper functions to the shared utility.

This commit is contained in:
Sandu Liviu Catalin 2016-06-07 03:04:57 +03:00
parent 0d6e80a9d5
commit 410a60cfe5
2 changed files with 64 additions and 0 deletions

View File

@ -750,6 +750,50 @@ Object MakeULongObj(HSQUIRRELVM vm, Uint64 val)
return Var< Object >(vm, -1).value;
}
// ------------------------------------------------------------------------------------------------
Int64 FetchSLongObjVal(Object & val)
{
// Obtain the initial stack size
const StackGuard sg(DefaultVM::Get());
// Push the specified object onto the stack
Var< Object & >::push(DefaultVM::Get(), val);
// Retrieve and return the object value from the stack
return PopStackSLong(DefaultVM::Get(), -1);
}
// ------------------------------------------------------------------------------------------------
Uint64 FetchULongObjVal(Object & val)
{
// Obtain the initial stack size
const StackGuard sg(DefaultVM::Get());
// Push the specified object onto the stack
Var< Object & >::push(DefaultVM::Get(), val);
// Retrieve and return the object value from the stack
return PopStackSLong(DefaultVM::Get(), -1);
}
// ------------------------------------------------------------------------------------------------
Int64 FetchSLongObjVal(HSQUIRRELVM vm, Object & val)
{
// Obtain the initial stack size
const StackGuard sg(vm);
// Push the specified object onto the stack
Var< Object & >::push(vm, val);
// Retrieve and return the object value from the stack
return PopStackSLong(vm, -1);
}
// ------------------------------------------------------------------------------------------------
Uint64 FetchULongObjVal(HSQUIRRELVM vm, Object & val)
{
// Obtain the initial stack size
const StackGuard sg(vm);
// Push the specified object onto the stack
Var< Object & >::push(vm, val);
// Retrieve and return the object value from the stack
return PopStackSLong(vm, -1);
}
// ------------------------------------------------------------------------------------------------
SQInteger PopStackInteger(HSQUIRRELVM vm, SQInteger idx)
{

View File

@ -1450,6 +1450,26 @@ Object MakeSLongObj(HSQUIRRELVM vm, Int64 val);
*/
Object MakeULongObj(HSQUIRRELVM vm, Uint64 val);
/* ------------------------------------------------------------------------------------------------
* Retrieve a signed 64 bit integer from an signed long integer object.
*/
Int64 FetchSLongObjVal(Object & val);
/* ------------------------------------------------------------------------------------------------
* Retrieve a unsigned 64 bit integer from an unsigned long integer object.
*/
Uint64 FetchULongObjVal(Object & val);
/* ------------------------------------------------------------------------------------------------
* Retrieve a signed 64 bit integer from an signed long integer object.
*/
Int64 FetchSLongObjVal(HSQUIRRELVM vm, Object & val);
/* ------------------------------------------------------------------------------------------------
* Retrieve a unsigned 64 bit integer from an unsigned long integer object.
*/
Uint64 FetchULongObjVal(HSQUIRRELVM vm, Object & val);
/* ------------------------------------------------------------------------------------------------
* Attempt to pop the value at the specified index on the stack as a native integer.
*/