Modula-2 Reloaded

A Modern Typesafe & Literate Programming Notation

Site Menu

Project

Specification

Implementation

Recommendations

Reference

Needs Updating

Work in Progress

Wastebasket

Wiki Manual

edit SideBar

Integers

DEFINITION MODULE Integers;

(* Alias types for Signed Integer Numbers *) 


IMPORT INT16, INT32, INT64, INT128;


(* SHORTINT - Alias for smallest integer type *)

IMPORT SHORTINT+; (* import into client module *)


(* LONGLONGINT - Alias for largest integer type *)

IMPORT LONGLONGINT+; (* import into client module *)


TYPE

(* INTEGER16 - Alias type for 16-bit signed integers *)

<* IF TSIZE(INTEGER)*8 = 16 *>
    INTEGER16 = ALIAS OF INTEGER;
<* ELSE *>
    INTEGER16 = ALIAS OF INT16;
<* ENDIF *>


(* INTEGER32 - Alias type for 32-bit signed integers *)

<* IF TSIZE(INTEGER)*8 = 32 *>
    INTEGER32 = ALIAS OF INTEGER;
<* ELSIF TSIZE(LONGINT)*8 = 32 *>
    INTEGER32 = ALIAS OF LONGINT;
<* ELSE *>
    INTEGER32 = ALIAS OF INT32;
<* ENDIF *>


(* INTEGER64 - Alias type for 64-bit signed integers *)

<* IF TSIZE(INTEGER)*8 = 64 *>
    INTEGER64 = ALIAS OF INTEGER;
<* ELSIF TSIZE(LONGINT)*8 = 64 *>
    INTEGER64 = ALIAS OF LONGINT;
<* ELSE *>
    INTEGER64 = ALIAS OF INT64;
<* ENDIF *>


(* INTEGER128 - Alias type for 128-bit signed integers *)

<* IF TSIZE(INTEGER)*8 = 128 *>
    INTEGER128 = ALIAS OF INTEGER;
<* ELSIF TSIZE(LONGINT)*8 = 128 *>
    INTEGER128 = ALIAS OF LONGINT;
<* ELSE *>
    INTEGER128 = ALIAS OF INT128;
<* ENDIF *>

END Integers.