Re: ULONG to Visual Basic 6

From: Karl E. Peterson (karl_at_mvps.org)
Date: 02/05/04


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.


Relevant Pages

  • ULONG to Visual Basic 6
    ... Im traslating a ... unsigned data types. ... translation but it never worked. ... /* extract numbers */ ...
    (microsoft.public.vb.general.discussion)
  • Re: Graphics transforms
    ... I now want to use that rectangle to describe the part of the image I want to ... To grab it I'm stuffing it in a BufferedImage by drawing on its Graphics ... But I can't figure out the translation to get it ... You reverse the translations you've done. ...
    (comp.lang.java.gui)
  • Re: access violation when try Hardware Detection Demo
    ... > How do i fix this error? ... I've found that translation has problems for me as well. ... Grab SetupAPI.zip from: ... Ignacio ...
    (borland.public.delphi.nativeapi)