Results 1 to 9 of 9

Thread: Handling Unsigned Long (Resolved)

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Posts
    258

    Handling Unsigned Long (Resolved)

    Hi guys,

    I'm sure this is easy for you lot, but I'm having trouble finding a solution.

    I have a CRC32 calculation I wrote in C and am now porting it to VB, but storing the values as Long or Currency doesn't seem to help. When I use long values it treats the value as signed which messes things up in the divide etc, and when I use Currency I get overflow errors.

    The calc is below:

    Code:
    Function crc(a As Long, b As Long) as long
    Dim p1, p2 As Long
    
    p1 = ((a) Xor (b))
    p1 = p1 And &HFF
    p2 = ((a) / 256)
    
    crc = CrcTable(p1) Xor p2
    End Function
    CRCTable is an array of Unsigned Long values which I've inserted as &H values.

    I'd appreciate any help with this, as I'm sure there must be a work around.

    Thanks
    Last edited by LucaUWF; Jan 12th, 2007 at 06:48 AM. Reason: Resolved

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width