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

Type UNSIGNED

WiP.TypeUNSIGNED History

Hide minor edits - Show changes to output

2010-03-21 16:51 by benjk -
Added lines 1-11:
[[#TypeUnsigned]]
!!!!!Type @@UNSIGNED@@

Type @@UNSIGNED@@ would be an unsigned integer type large enough to hold any value in the range 0 to 2'^15^' and any value of type @@SYSTEM.WORD@@ whichever is larger. Types @@CARDINAL@@ and @@LONGCARD@@ would become subsets of @@INTEGER@@ and @@LONGINT@@ respectively and they could then be library defined types.

The type would be defined as:
>>background-color:#f4f4f4 padding:0.5em border:'thin solid gray' whitespace:pre<<
@@TMIN(UNSIGNED) = 0@@ [[<<]]
@@TMAX(UNSIGNED) = pow(2, TSIZE(UNSIGNED) * 8)@@ [[<<]]
@@TSIZE(UNSIGNED) >= MAX(TSIZE(OCTET) * 2, TSIZE(WORD))@@ [[<<]]
>><<