mirror of
https://github.com/luau-lang/luau.git
synced 2025-04-19 03:03:49 +01:00
Allow vector fastcall constructor to work with 3-4 arguments with 4-wide vectors (#511)
This commit is contained in:
parent
9619f036ac
commit
b44912cd20
1 changed files with 7 additions and 5 deletions
|
@ -1018,18 +1018,20 @@ static int luauF_tunpack(lua_State* L, StkId res, TValue* arg0, int nresults, St
|
||||||
|
|
||||||
static int luauF_vector(lua_State* L, StkId res, TValue* arg0, int nresults, StkId args, int nparams)
|
static int luauF_vector(lua_State* L, StkId res, TValue* arg0, int nresults, StkId args, int nparams)
|
||||||
{
|
{
|
||||||
#if LUA_VECTOR_SIZE == 4
|
|
||||||
if (nparams >= 4 && nresults <= 1 && ttisnumber(arg0) && ttisnumber(args) && ttisnumber(args + 1) && ttisnumber(args + 2))
|
|
||||||
#else
|
|
||||||
if (nparams >= 3 && nresults <= 1 && ttisnumber(arg0) && ttisnumber(args) && ttisnumber(args + 1))
|
if (nparams >= 3 && nresults <= 1 && ttisnumber(arg0) && ttisnumber(args) && ttisnumber(args + 1))
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
double x = nvalue(arg0);
|
double x = nvalue(arg0);
|
||||||
double y = nvalue(args);
|
double y = nvalue(args);
|
||||||
double z = nvalue(args + 1);
|
double z = nvalue(args + 1);
|
||||||
|
|
||||||
#if LUA_VECTOR_SIZE == 4
|
#if LUA_VECTOR_SIZE == 4
|
||||||
double w = nvalue(args + 2);
|
double w = 0.0;
|
||||||
|
if (nparams >= 4)
|
||||||
|
{
|
||||||
|
if (!ttisnumber(args + 2))
|
||||||
|
return -1;
|
||||||
|
w = nvalue(args + 2);
|
||||||
|
}
|
||||||
setvvalue(res, float(x), float(y), float(z), float(w));
|
setvvalue(res, float(x), float(y), float(z), float(w));
|
||||||
#else
|
#else
|
||||||
setvvalue(res, float(x), float(y), float(z), 0.0f);
|
setvvalue(res, float(x), float(y), float(z), 0.0f);
|
||||||
|
|
Loading…
Add table
Reference in a new issue