Valhalla Legends Forums Archive | C/C++ Programming | Converting Code

AuthorMessageTime
Infamous
I'm have some problems converting this code to VB

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

Heres what I have so far..

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

This is what I do not understand.
[code]
(DWORD)(*(unsigned __int64 *)

and

pos&7

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

Thanks.
November 2, 2005, 7:06 PM
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 [i]And][i].
November 2, 2005, 9:20 PM
rabbit
[tt](DWORD)(*(unsigned __int64 *)[/tt] can safely be declared as Long in VB.
November 2, 2005, 11:46 PM
Infamous
Thanks for the help.  :)
November 2, 2005, 11:59 PM

Search