Long2ULong - Interpret the binary value of a LONG value as unsigned

Top  Previous  Next

Syntax

 

<nULong> := Long2ULong( <nLong> )

 

Parameters

 

<nLong>

 

LONG value to be converted to a ULONG (unsigned long).

 

Return value

 

The ULONG value that results if the bits in <nLong> are interpreted as unsigned.

 

Description

 

Long2ULong converts an signed 32 bit value into an unsigned 32 bit value. In C a 32bit value can be interpreted in different ways. This interpretation is defined by the type. For example the binary value 11111111 11111111 11111111 11111111 could be interpreted as +4294967295 (ULONG) or as -1 (LONG).

 

So what this function actually does is reinterpret the bit pattern of the LONG <nLong> as a ULONG.

 

Classification

 

Core

 

Category

 

Type Conversion

 

Quick Info

 

Library: cckptcor.lib / cckptcor.dll

 

See also

 

ULong2Long

 

Example

 

 

#INCLUDE "CockpitCoreLibs.ch"

 

FUNCTION Main

 

LOCAL ul, l

 

l := -1

 

* reinterpret the bits as an unsigned long value

ul := Long2ULong(l)

 

* Display the result (should be 4294967295)

? ul

 

RETURN NIL