Skip to content

Int64

Int64 implements basic arithmetic for 64-bit integers based on machine code (hence the function signatures are also in machine code style). Furthermore, Int64 offers the constructor int64@ for Int64 objects, but mk64 expects a pointer, not a handle.

Dependencies

N/A

Initialization

N/A

Implementation

Int64.d on GitHub

Functions

mk64

Writes lo and hi in one place (dest). Makes Int64, hi has to be -1 for negative 32bit lo.

func void mk64(var int dest, var int hi, var int lo)
Parameters
  • var int dest
    A pointer to an Int64 object or just 8 bytes of free memory.
  • var int hi
    High part of integer.
  • var int lo
    Low part of integer.
Examples

Function looks like that:

1
2
3
4
    func void mk64(var int dest, var int lo, var int hi) {
    MEM_WriteInt(dest, lo);
    MEM_WriteInt(dest+4, hi);
    };
So if you want to get 9876543210 low part should be set to 1286608618 and the high part to 2
1
2
3
4
5
6
var int ptr; ptr = MEM_Alloc(8);
var int low; low = 1286608618;
var int high; high = 2;
mk64(ptr, low, high);
// ...
MEM_Free(ptr);

neg64

Negates the integer: *dest <- -(*dest)

func void neg64(var int dest)
Parameters
  • var int dest
    A pointer to an Int64 object or just 8 bytes of free memory.

add64

Adds src to dest: *dest <- *dest + *src

func void add64(var int dest, var int src)
Parameters
  • var int dest
    A pointer to an Int64 object or just 8 bytes of free memory. Will be changed.
  • var int src
    A pointer to an Int64 object. Will not change.

sub64

Subtracts src from dest: *dest <- *dest - *src

func void sub64(var int dest, var int src)
Parameters
  • var int dest
    A pointer to an Int64 object or just 8 bytes of free memory. Will be changed.
  • var int src
    A pointer to an Int64 object. Will not change.

mul64

Multiplies dest by src: *dest <- (*dest) * (*src)

func void mul64(var int dest, var int src)
Parameters
  • var int dest
    A pointer to an Int64 object or just 8 bytes of free memory. Will be changed.
  • var int src
    A pointer to an Int64 object. Will not change.

div64

Divides dest by src: *dest <- *dest / *src

func void mul64(var int dest, var int src)
Parameters
  • var int dest
    A pointer to an Int64 object or just 8 bytes of free memory. Will be changed.
  • var int src
    A pointer to an Int64 object. Will not change.