BitTwiddling.Mesa
Last Edited by: Spreitzer, April 27, 1985 2:49:18 pm PST
DIRECTORY Basics, PrincOps, RoseTypes;
BitTwiddling: CEDAR--not really, but what the hey, you'd just put TRUSTEDs around it, right?-- DEFINITIONS = {
Ptr: TYPE = PrincOps.BitAddress;
Field: TYPE = RoseTypes.Field;
WordPtr: TYPE = RoseTypes.WordPtr;
Copy: PROC [from, to: Ptr, bitCount: NAT, bbTable: PrincOps.BitBltTablePtr];
Equal: PROC [p1, p2: Ptr, bits: NAT] RETURNS [equal: BOOL];
OffsetPtr: PROC [p: Ptr, bits: INT] RETURNS [q: Ptr];
WPField: PROC [WordPtr, Field] RETURNS [Ptr];
TwoToThe: ARRAY [0 .. Basics.bitsPerWord] OF LONG CARDINAL = [
00001H, 00002H, 00004H, 00008H,
00010H, 00020H, 00040H, 00080H,
00100H, 00200H, 00400H, 00800H,
01000H, 02000H, 04000H, 08000H,
010000H];
oneLessThanTwoToThe: ARRAY [0 .. Basics.bitsPerWord] OF CARDINAL = [
0,
00001H, 00003H, 00007H, 0000FH,
0001FH, 0003FH, 0007FH, 000FFH,
001FFH, 003FFH, 007FFH, 00FFFH,
01FFFH, 03FFFH, 07FFFH, 0FFFFH];
zeroFirst: ARRAY [0 .. Basics.bitsPerWord] OF CARDINAL = [
0FFFFH, 07FFFH, 03FFFH, 01FFFH,
00FFFH, 007FFH, 003FFH, 001FFH,
000FFH, 0007FH, 0003FH, 0001FH,
0000FH, 00007H, 00003H, 00001H,
00000H];
zeroLast: ARRAY [0 .. Basics.bitsPerWord] OF CARDINAL = [
0FFFFH, 0FFFEH, 0FFFCH, 0FFF8H,
0FFF0H, 0FFE0H, 0FFC0H, 0FF80H,
0FF00H, 0FE00H, 0FC00H, 0F800H,
0F000H, 0E000H, 0C000H, 08000H,
00000H];
lastMasks: ARRAY [0 .. Basics.bitsPerWord) OF CARDINAL = [
0FFFFH,
08000H, 0C000H, 0E000H, 0F000H,
0F800H, 0FC00H, 0FE00H, 0FF00H,
0FF80H, 0FFC0H, 0FFE0H, 0FFF0H,
0FFF8H, 0FFFCH, 0FFFEH];
}.