


## tagged-unt-guts.pkg
# Compiled by:
# src/lib/std/src/standard-core.sublib### "Silence is better than unmeaning words."
###
### -- Pythagoras
package tagged_unt_guts: (weak) Unt { # Unt is from src/lib/std/src/unt.api # # inline_t is from src/lib/core/init/built-in.pkg #
package w31 = inline_t::tu; # "tu" == "tagged unsigned int": 31-bits on 32-bit architectures, 63-bits on 64-bit architectures.
package lw= one_word_unt; # one_word_unt is from src/lib/std/types-only/basis-structs.pkg Unt = Unt;
unt_size = 31; # 64-bit issue: This will be 63 on 64-bit architectures.
my to_large_unt: Unt -> large_unt::Unt = w31::to_large_unt;
my to_large_unt_x: Unt -> large_unt::Unt = w31::to_large_unt_x;
my from_large_unt: large_unt::Unt -> Unt = w31::from_large_unt;
my to_multiword_int: Unt -> multiword_int::Int = w31::to_large_int;
my to_multiword_int_x: Unt -> multiword_int::Int = w31::to_large_int_x;
my from_multiword_int: multiword_int::Int -> Unt = w31::from_large_int;
my to_int: Unt -> Int = w31::to_int;
my to_int_x: Unt -> Int = w31::to_int_x;
my from_int: Int -> Unt = w31::from_int;
my bitwise_or: (Unt, Unt) -> Unt = w31::bitwise_or;
my bitwise_xor: (Unt, Unt) -> Unt = w31::bitwise_xor;
my bitwise_and: (Unt, Unt) -> Unt = w31::bitwise_and;
my bitwise_not: Unt -> Unt = w31::bitwise_not;
my (*) : (Unt, Unt) -> Unt = w31::(*);
my (+) : (Unt, Unt) -> Unt = w31::(+);
my (-) : (Unt, Unt) -> Unt = w31::(-);
my (/) : (Unt, Unt) -> Unt = w31::div ;
my (%) : (Unt, Unt) -> Unt = w31::mod ;
my (<<) : (Unt, Unt) -> Unt = w31::check_lshift;
my (>>) : (Unt, Unt) -> Unt = w31::check_rshiftl;
my (>>>) : (Unt, Unt) -> Unt = w31::check_rshift;
fun compare (w1, w2)
=
if (w31::(<) (w1, w2)) LESS;
elif (w31::(>) (w1, w2)) GREATER;
else EQUAL;
fi;
my (>) : (Unt, Unt) -> Bool = w31::(>);
my (>=) : (Unt, Unt) -> Bool = w31::(>=);
my (<) : (Unt, Unt) -> Bool = w31::(<);
my (<=) : (Unt, Unt) -> Bool = w31::(<=);
my (-_): Unt -> Unt = (-_);
my min: (Unt, Unt) -> Unt = w31::min;
my max: (Unt, Unt) -> Unt = w31::max;
fun format radix
=
(num_format::format_unt radix) o w31::to_large_unt;
to_string = format number_string::HEX;
fun scan radix
=
scan'
where
scan_large = num_scan::scan_word radix;
fun scan' getc cs
=
case (scan_large getc cs)
#
NULL => NULL;
THE (w, cs')
=>
if (inline_t::u1::(>) (w, 0ux7FFFFFFF)) # 64-bit issue.
#
raise exception OVERFLOW;
else
THE (w31::from_large_unt w, cs');
fi;
esac;
end;
from_string = pre_basis::scan_string (scan number_string::HEX);
}; # package tagged_unt_guts
## COPYRIGHT (c) 1995 AT&T Bell Laboratories.
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2012,
## released under Gnu Public Licence version 3.


