Hello, I have problem with this function:
Private Function LShift(lValue,iShiftBits)
If iShiftBits=0 Then
LShift=lValue
Exit Function
ElseIf iShiftBits=31 Then
If lValue And 1 Then
LShift=&H80000000
Else
LShift=0
End If
Exit Function
ElseIf iShiftBits<0 Or iShiftBits>31 Then
Err.Raise 6
End If
If (lValue And m_l2Power(31-iShiftBits)) Then
LShift=((lValue And m_lOnBits(31-(iShiftBits+1)))*m_l2Power(iShiftBits)) Or &H80000000
Else
LShift=((lValue And m_lOnBits(31-iShiftBits))*m_l2Power(iShiftBits))
End If
End Function
So far I'v got
private uint LShift(int lValue, int iShiftBits)
{
int res = 0;
if (iShiftBits == 0)
{
res = lValue;
}
else if (iShiftBits == 31)
{
if (lValue > 0)
{
res = 0x80000000;
}
else
{
res = 0;
}
}
else if (iShiftBits < 0 || iShiftBits > 31)
{
//error 6
}
if (lValue > 0 && m_l2Power[31 - iShiftBits] > 0)
{
res = ((lValue && m_lOnBits[31-(iShiftBits+1)])*m_l2Power[iShiftBits]) || 0x80000000;
}
else
{
res = lValue && m_lOnBits[31-iShiftBits])*m_l2Power[iShiftBits]);
}
return res;
}
but obviously it's not working.... the lvalue and res values are sometimes treated as bool.... does someone understand what
LShift=((lValue And m_lOnBits(31-(iShiftBits+1)))*m_l2Power(iShiftBits)) Or &H80000000 means??
Thanks!