crc16 - Conversion issues In VBA Excel- Why HFFF is giving -1 in long and how to resolve it -
i using vb in excel , creating macro crc16 bit calculation. when take values lookup table above 8000 ffff, giving negative numbers. got know numbers below range positive , numbers in range(8000-ffff) give negative result has converted. came across few functions these dont solve purpose
is possible conversion using simple function can correct result.
hffff gives -1 long variable want 65535.
i have used functions given here http://support.microsoft.com/kb/161304 not give me correct result when pass hex value hffff.
hexadecimal constants signed. described in vba spec: http://msdn.microsoft.com/en-us/library/ee199514.aspx
there 2 ways around issue:
1) use literal decimal
2) use ampersand type hint &hffff&
Comments
Post a Comment