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

Bitsets

DEFINITION MODULE Bitsets;

(* Alias types for Bitsets *) 


IMPORT BS16, BS32, BS64, BS128;


(* SHORTBITSET - Alias for smallest bitset type *)

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


(* LONGLONGBITSET - Alias for largest bitset type *)

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


TYPE

(* BITSET16 - Alias type for 16-bit bitset type *)

<* IF TSIZE(BITSET)*8 = 16 *>
    BITSET16 = ALIAS OF BITSET;
<* ELSE *>
    BITSET16 = ALIAS OF BS16;
<* ENDIF *>


(* BITSET32 - Alias type for 32-bit bitset type *)

<* IF TSIZE(BITSET)*8 = 32 *>
    BITSET32 = ALIAS OF BITSET;
<* ELSIF TSIZE(LONGBITSET)*8 = 32 *>
    BITSET32 = ALIAS OF LONGBITSET;
<* ELSE *>
    BITSET32 = ALIAS OF BS32;
<* ENDIF *>


(* BITSET64 - Alias type for 64-bit bitset type *)

<* IF TSIZE(BITSET)*8 = 64 *>
    BITSET64 = ALIAS OF BITSET;
<* ELSIF TSIZE(LONGBITSET)*8 = 64 *>
    BITSET64 = ALIAS OF LONGBITSET;
<* ELSE *>
    BITSET64 = ALIAS OF BS64;
<* ENDIF *>


(* BITSET128 - Alias type for 128-bit bitset type *)

<* IF TSIZE(BITSET)*8 = 128 *>
    BITSET128 = ALIAS OF BITSET;
<* ELSIF TSIZE(LONGBITSET)*8 = 128 *>
    BITSET128 = ALIAS OF LONGBITSET;
<* ELSE *>
    BITSET128 = ALIAS OF BS128;
<* ENDIF *>

END Bitsets.