User Tools

Site Tools


64bit_integers.htm
Navigation:  Language Reference > 3 - Variable Declarations > Data Types >64bit integer functions (backward compatibility) Previous pageReturn to chapter overviewNext page

Note: 64bit data types are natively supported starting with Clarion 11.  See INT64 and UINT64

This information is retained strictly for backward compatibility.


The Clarion RTL supports working with with 64-bit signed and unsigned integers.  The RTL has 19 functions which provide a means to assign values, add, subtract, multiply, divide, bit-shift, convert to/from decimals, and more.

How to define a data structure to work with 64bit Intergers

(applicable for FILE structures or variables):

! Declaration of INT64 and UINT64 types

!

INT64    GROUP,TYPE

lo         ULONG

hi         LONG

END

!

UINT64   GROUP,TYPE

lo         ULONG

hi         ULONG

END

List of i64 functions:

·i64Sign                ' return the sign

·i64Negate                ' change the sign like the unary operator for numbers

·i64ABS                ' equivalent to ABS()

·i64Is0                ' check for equality to 0

·is32Bit                ' check the high half of number to be equal to 0

·i64Assign                ' equivalent to the = assignment operator

·i64To32                ' take the lower 32 bits of the value

·i64FromDecimal        ' direct DECIMAL to 64-bit integer conversion

·i64ToDecimal        ' direct 64-bit integer to DECIMAL conversion

·i64Shift                ' equivalent to BSHIFT (value, n)

·i64LShift                ' equivalent to BSHIFT (value, n) if n is positive

·i64RShift                ' equivalent to BSHIFT (value, -n) if n is positive

·i64Add                ' equivalent to binary + operator

·i64Sub                ' equivalent to binary ' operator

·i64Mult2                ' equivalent to n*=2

·i64Mult10                ' equivalent to n=n*10+k

·i64Mult                ' equivalent to * operator

·i64Div10                 ' equivalent to x=n%10; n/=10

·i64Div                ' equivalent to / operator

Note: i64Div10 and i64Div for signed 64-bit integers assumes that the define(compatible_modulus) pragma is set to 'ON'.

See the i64.inc file for further details (located in Clarion\Libsrc\Win folder)

The i64.INC is self-documenting, it uses inline comments to describe the both parameters and return values.

Here is an example taken from the i64.inc file:

!!! <;summary>

!!! Assign 32-bit value to passed 64-bit integer variable

!!! <;/summary>

!!! <;param name='dest'>Variable to change.<;/param>

!!! <;param name='src'>Value to assign to destination variable.<;/param>

i64Assign      PROCEDURE (*INT64 dest, LONG src),RAW,NAME('Cla$i64AssignS')

64bit_integers.htm.txt · Last modified: 2021/04/15 15:56 (external edit)