Re: ULONG to Visual Basic 6
From: Karl E. Peterson (karl_at_mvps.org)
Date: 02/05/04
- Next message: Patrick Cohan: "Re: convert string to byte array"
- Previous message: Joseph M. Ferris: "Re: Urgent Please help"
- In reply to: Antonio Orozco: "ULONG to Visual Basic 6"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 5 Feb 2004 09:33:44 -0800
I wrote a whole bunch of bit-twiddling routines, long ago, and maybe some of those
might help. Grab Twiddle.zip from http://www.mvps.org/vb/samples.htm if you're
interested.
--
[Microsoft Basic: 1976-2001, RIP]
Antonio Orozco <castilla1712@hotmail.com> wrote:
> I know, ?'ve already read all the message about this but i can't make
> my code to get working. Ok, here is my problem: Im traslating a
> program written in C to a Visual Basic 6 Function, everything was fine
> until i found some ULong declarations, i know vb doesn't handle
> unsigned data types. Today I spent all my time trying to di this
> translation but it never worked.
>
> This is the part of code in C i want to translate:
>
> /* extract numbers */
> unsigned long A,B,C;
> double Num=0;
> pNumCode+=2;
> A=(*(pNumCode+5)<<8)+(*(pNumCode+4));
>
>
>
>
> B=(*(pNumCode+3)<<24)+(*(pNumCode+2)<<16)+(*(pNumCode+1)<<8)+(*(pNumCode+0));
> for(int i=0;i<NbitChiffre;i++){ if(B&0x1){Num+=pow(2,i);}
> B=(B>>1)+((A&0x1)<<31);
>>> =1;
> }
>
> triying with signed longs i get an overflow error on this line
> B=(B>>1)+((A&0x1)<<31);
>
>
> thnx.
- Next message: Patrick Cohan: "Re: convert string to byte array"
- Previous message: Joseph M. Ferris: "Re: Urgent Please help"
- In reply to: Antonio Orozco: "ULONG to Visual Basic 6"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|