problem migrating asp vbscript function to c#

Last post 11-09-2009 5:49 AM by integrasol. 1 replies.

Sort Posts:

  • problem migrating asp vbscript function to c#

    11-08-2009, 10:22 PM
    • Member
      20 point Member
    • diegolaz
    • Member since 12-01-2005, 7:57 PM
    • Posts 7

    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!
  • Re: problem migrating asp vbscript function to c#

    11-09-2009, 5:49 AM
    • Star
      8,812 point Star
    • integrasol
    • Member since 06-05-2009, 11:18 AM
    • Denmark & Spain
    • Posts 1,633
    Thanks

    Carsten

    Please click Mark as Answer if this post is of help to you. :-)



    My Blog
Page 1 of 1 (2 items)