comp.lang.ada
 help / color / mirror / Atom feed
From: "Steve" <nospam_steved94@attbi.com>
Subject: Re: Minimum Record Size?  LONG
Date: Mon, 28 Apr 2003 05:04:12 GMT
Date: 2003-04-28T05:04:12+00:00	[thread overview]
Message-ID: <gD2ra.650405$F1.86415@sccrnsc04> (raw)
In-Reply-To: 4VWqa.39167$b9.13645@fe07.atl2.webusenet.com

Maybe I'm dense, but I just can't see why the slice approach isn't endian
independent.  I would expect the mapping to be something like:

  Sixbit(1) bit 0 => Eightbit(1) bit 0
  Sixbit(1) bit 1 => Eightbit(1) bit 1
  Sixbit(1) bit 2 => Eightbit(1) bit 2
  Sixbit(1) bit 3 => Eightbit(1) bit 3
  Sixbit(1) bit 4 => Eightbit(1) bit 4
  Sixbit(1) bit 5 => Eightbit(1) bit 5
  Sixbit(2) bit 0 => Eightbit(1) bit 6
  Sixbit(2) bit 1 => Eightbit(1) bit 7
  Sixbit(2) bit 2 => Eightbit(2) bit 0
  Sixbit(2) bit 3 => Eightbit(2) bit 1
  Sixbit(2) bit 4 => Eightbit(2) bit 2
  Sixbit(2) bit 5 => Eightbit(2) bit 3
  Sixbit(3) bit 0 => Eightbit(2) bit 4
  Sixbit(3) bit 1 => Eightbit(2) bit 5
  Sixbit(3) bit 2 => Eightbit(2) bit 6
  Sixbit(3) bit 3 => Eightbit(2) bit 7
  Sixbit(3) bit 4 => Eightbit(3) bit 0
  Sixbit(3) bit 5 => Eightbit(3) bit 1
  Sixbit(4) bit 0 => Eightbit(3) bit 2
  Sixbit(4) bit 1 => Eightbit(3) bit 3
  Sixbit(4) bit 2 => Eightbit(3) bit 4
  Sixbit(4) bit 3 => Eightbit(3) bit 5
  Sixbit(4) bit 4 => Eightbit(3) bit 6
  Sixbit(4) bit 5 => Eightbit(3) bit 7

If you want to look at which "bytes" the results fall into, yes I agree that
it is endian independant, thus my remark about re-arranging the result.  I
still think my slice solution works for both endian machines.

I also find the use of shifts an accepatable answer.  I personally don't
like using multiplciation to do shifts.  Use the operation that describes
what you're doing.  Not something that gives the same result.

Steve
(The Duck)


"David C. Hoos" <david.c.hoos.sr@ada95.com> wrote in message
news:4VWqa.39167$b9.13645@fe07.atl2.webusenet.com...
> I haven't communicated my point very well.
>
> The slice approach is not endianness-independent.
>
> The arithmetic approach given by Tom Moran which was an
> improvement on my original submission is endianness-independent
> (as was my original submission).
>
> The point is that merely re-ordering the parameters to
> your procedure will not work on a big-endian machine
> without re-coding the procedure itself.
>
> The bit orders need to be reversed, as well.
>
[snip]





      reply	other threads:[~2003-04-28  5:04 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
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 [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox