Commit 0ba86d81 authored by Jason Edmeades's avatar Jason Edmeades Committed by Alexandre Julliard

Add support for VarAnd between integers.

parent dd738eab
......@@ -5076,7 +5076,6 @@ HRESULT WINAPI VarAnd(LPVARIANT left, LPVARIANT right, LPVARIANT result)
{
HRESULT rc = E_FAIL;
TRACE("Left Var:\n");
dump_Variant(left);
TRACE("Right Var:\n");
......@@ -5094,7 +5093,56 @@ HRESULT WINAPI VarAnd(LPVARIANT left, LPVARIANT right, LPVARIANT result)
rc = S_OK;
} else {
FIXME("VarAnd stub\n");
/* Integers */
BOOL lOk = TRUE;
BOOL rOk = TRUE;
LONGLONG lVal = -1;
LONGLONG rVal = -1;
LONGLONG res = -1;
int resT = 0; /* Testing has shown I2 & I2 == I2, all else
becomes I4, even unsigned ints (incl. UI2) */
lOk = TRUE;
switch (V_VT(left)&VT_TYPEMASK) {
case VT_I1 : lVal = V_UNION(left,cVal); resT=VT_I4; break;
case VT_I2 : lVal = V_UNION(left,iVal); resT=VT_I2; break;
case VT_I4 : lVal = V_UNION(left,lVal); resT=VT_I4; break;
case VT_INT : lVal = V_UNION(left,lVal); resT=VT_I4; break;
case VT_UI1 : lVal = V_UNION(left,bVal); resT=VT_I4; break;
case VT_UI2 : lVal = V_UNION(left,uiVal); resT=VT_I4; break;
case VT_UI4 : lVal = V_UNION(left,ulVal); resT=VT_I4; break;
case VT_UINT : lVal = V_UNION(left,ulVal); resT=VT_I4; break;
default: lOk = FALSE;
}
rOk = TRUE;
switch (V_VT(right)&VT_TYPEMASK) {
case VT_I1 : rVal = V_UNION(right,cVal); resT=VT_I4; break;
case VT_I2 : rVal = V_UNION(right,iVal); resT=max(VT_I2, resT); break;
case VT_I4 : rVal = V_UNION(right,lVal); resT=VT_I4; break;
case VT_INT : rVal = V_UNION(right,lVal); resT=VT_I4; break;
case VT_UI1 : rVal = V_UNION(right,bVal); resT=VT_I4; break;
case VT_UI2 : rVal = V_UNION(right,uiVal); resT=VT_I4; break;
case VT_UI4 : rVal = V_UNION(right,ulVal); resT=VT_I4; break;
case VT_UINT : rVal = V_UNION(right,ulVal); resT=VT_I4; break;
default: rOk = FALSE;
}
if (lOk && rOk) {
res = (lVal & rVal);
V_VT(result) = resT;
switch (resT) {
case VT_I2 : V_UNION(result,iVal) = res; break;
case VT_I4 : V_UNION(result,lVal) = res; break;
default:
FIXME("Unexpected result variant type %x\n", resT);
V_UNION(result,lVal) = res;
}
rc = S_OK;
} else {
FIXME("VarAnd stub\n");
}
}
TRACE("rc=%d, Result:\n", (int) rc);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment