Next Previous Up Top Contents Index

6.3 The MACHINE-WORDS module

6.3.5 Unsigned single word operations

For all of the following functions, all arguments that are specified as being specialized to <machine-word> accept an instance of <abstract-integer>, which is then coerced to a <machine-word> before performing the operation.

u%+

Function

u%+ (m1 :: machine-word, m2 :: machine-word) => (sum :: machine-word, carry :: machine-word)

Unsigned addition. The value represented by carry is either 0 or 1.
u%-

Function

u%- (m1 :: machine-word, m2 :: machine-word) => (difference :: machine-word, borrow :: machine-word)

Unsigned subtraction. The value represented by borrow is either 0 or 1.
u%*

Function

u%* (m1 :: machine-word, m2 :: machine-word) => (low :: machine-word, high :: machine-word)

Unsigned multiplication.
u%divide

Function

u%divide (dividend :: machine-word, divisor :: machine-word) => (quotient :: machine-word, remainder :: machine-word)

Performs unsigned division of the dividend by the divisor, returning a quotient and remainder such that
(quotient * divisor + remainder = dividend)

An error is signaled if the value of the divisor is zero.
u%rotate-left

Function

u%rotate-left (m :: machine-word, count :: integer) => (r :: machine-word)

Logical left rotation of m by count. An error is signaled unless 0 <= count < $machine-word-size.
u%rotate-right

Function

u%rotate-right (m :: machine-word, count :: integer) => (r :: machine-word)

Logical right rotation of m by count. An error is signaled unless 0 <= count < $machine-word-size.
u%shift-left

Function

u%shift-left (m :: machine-word, count :: integer) => (r :: machine-word)

Logical left shift of m by count. An error is signaled unless 0 <= count < $machine-word-size.
u%shift-right

Function

u%shift-right (m :: machine-word, count :: integer) => (r :: machine-word)

Logical right shift of m by count. An error is signaled unless 0 <= count < $machine-word-size.
u%<

Function

u%< (m1 :: machine-word, m2 :: machine-word) => (smaller? :: boolean)

Unsigned comparison.

Common Dylan and Functional Extensions - 31 Mar 00

Next Previous Up Top Contents Index