• Welcome to Valhalla Legends Archive.
 

Converting Code

Started by teK, November 02, 2005, 01:06 PM

Previous topic - Next topic

teK

I'm have some problems converting this code to VB


DWORD dBitField = (DWORD)(*(unsigned __int64 *)(m_Data+pos/8)<<(64-len-(pos&7))>>(64-len));


Heres what I have so far..


Dim dBitField As Long
    dBitField = LShift(m_Data + Pos / 8, 64 - Leng - Pos & 7)
    dBitField = RShift(dBitField, 64 - Leng)


This is what I do not understand.

(DWORD)(*(unsigned __int64 *)

and

pos&7


Can someone please explain to me what this code is doing?

Thanks.

UserLoser.

(*(unsigned __int64 *) is a C style typecast, basically changing m_Data+Pos/8...whatever to an unsigned __int64 (64 bit unsigned integer).
& is bitwise and operator.  In VB you use And].

rabbit

(DWORD)(*(unsigned __int64 *) can safely be declared as Long in VB.
Grif: Yeah, and the people in the red states are mad because the people in the blue states are mean to them and want them to pay money for roads and schools instead of cool things like NASCAR and shotguns.  Also, there's something about ketchup in there.

teK