From: tmoran@acm.org
Subject: Re: Minimum Record Size? LONG
Date: Fri, 25 Apr 2003 21:51:35 GMT
Date: 2003-04-25T21:51:35+00:00 [thread overview]
Message-ID: <H5iqa.621548$L1.175962@sccrnsc02> (raw)
In-Reply-To: vaj0t9m90a568d@corp.supernews.com
>Here is an approach that, while verbose, is written to be understandable
>by the reader.
If the reader is careful and willing to study a shorter piece of code,
then, in the spirit of the OP's first try
>> -- assemble them into one segment
>> Segment := (Shift_Left(Part_1, 18) and 16#fc0000#) or
>> (Shift_Left(Part_2, 12) and 16#03f000#) or
>> (Shift_Left(Part_3, 6) and 16#000fc0#) or
>> (Shift_left(Part_4, 0) and 16#00003f#) ;
>>
>> -- split segment into three eight-bit hunks
>> Val_1 := (Shift_Right(Segment and 16#ff0000#, 16));
>> Val_2 := (Shift_Right(Segment and 16#00ff00#, 8));
>> Val_3 := (Shift_Right(Segment and 16#0000ff#, 0));
we can modify the function to:
> function Four_Sixes_To_Three_Eights (X : Four_Sixes)
> return Three_Eights
> is
> begin
return (1=> Eight(x(1))*4 + Eight(x(2))/16,
2=> (Eight(x(2)) mod 16)*16 + Eight(x(3))/4,
3=> (Eight(x(3)) mod 4)*64 + Eight(x(4)));
> end Four_Sixes_To_Three_Eights;
next prev parent reply other threads:[~2003-04-25 21:51 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-04-25 16:33 Minimum Record Size? LONG Dr Nancy's Sweetie
2003-04-25 17:35 ` Stephen Leake
2003-04-25 17:36 ` Mark Johnson
2003-04-25 21:54 ` tmoran
2003-04-25 18:51 ` David C. Hoos
2003-04-25 21:51 ` tmoran [this message]
2003-04-26 3:00 ` David C. Hoos
2003-04-26 2:12 ` Steve
2003-04-27 1:57 ` Rick Stikkers
2003-04-27 12:06 ` David C. Hoos
2003-04-27 14:17 ` Steve
2003-04-27 20:25 ` David C. Hoos
2003-04-28 5:04 ` Steve
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox