Re: Cohen's paper on byte order
From: Paul Schlyter (pausch_at_saaf.se)
Date: 05/23/03
- Next message: Paul Crowley: "Re: Triple AES (3AES)"
- Previous message: Paul Schlyter: "Re: Triple AES (3AES)"
- In reply to: Mok-Kong Shen: "Re: Cohen's paper on byte order"
- Next in thread: Mok-Kong Shen: "Re: Cohen's paper on byte order"
- Reply: Mok-Kong Shen: "Re: Cohen's paper on byte order"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Fri, 23 May 2003 07:39:34 +0000 (UTC)
In article <3ECD4CFD.F8DE9996@t-online.de>,
Mok-Kong Shen <mok-kong.shen@t-online.de> wrote:
> Paul Schlyter wrote:
>>
>> Mok-Kong Shen <mok-kong.shen@t-online.de> wrote:
>>
>
>>> Ah, sorry, I see my typo. One should read 'these are
>>> 'independent' of the ...'. (The typo should be apparent,
>>> as the phrase otherwise doesn't make sense.) Is that o.k.
>>> now?
>>
>> That's really bad --- then you insist on your error....
>>
>> Don't you see the clumsiness of your definition of "endian-ness"?
>> If you had it your way, one would have to know the "endian-ness"
>> AND the direction from which one is reading, to be able to figure
>> out the correct value of the number.
>
> It's not 'my' definition. If it's good, that's not
> to my credit. If it's clumsy, that's not my fault.
> The definition is simply that and found thru Google.
First of all, there's a lot of garbage out on the Net.
Just because Google can locate some web page doesn't make
that page an authoritative source.
I've done some Google searches too, and haven't found
anyhting which defines endian-ness except when storing
numbers in computer memory.
> If one doesn't assume an implicitly given endian-ness
> (commonly one does assume bin-endian for numbers on
> paper), then of course one needs to know the endian-ness
> to interpret a digit sequence as a whole number. Could
> you do it without??
Of course you need to know the endianness of the number,
either explicitly or implicitly.
> Direction of reading has nothing to do with the value
> of the number. (How many times have I said that?)
OF COURSE direction of reading has nothing to do with the value of
the number! But it's only the FIRST time you say that! Earlier you
merely said "Direction of reading doesn't matter", and since we were
discussing endian-ness I interpreted it as "Direction of reading
doesn't matter to the endian-ness". Now you added the clarification
"...the value of the number". That's an important clarification, and
it's the first time you've included that clarification.
> You have to read all the digits
:-) ....of course.....
> and have mentally the same image as that on paper in your mind.
:-) ...no, that's not necessary! I do not think a computer has
"mentally the same image as that on paper in its 'mind'", yet
the computer is capable of figuring out the value of a number if
you feed it a string of digits.
> Now from the positions you get the power of the base
> associated with these and can compute the value of
> the number.
You could do it that way, yes, but there are other ways too. For
instance, you can just consider the string of digits (or bytes) you
read, in reading order, and that combined with the information about
the endian-ness of that string will be enough to uniquely determine
the value of the number.
>> With a more sensible definition of endian-ness (big-endian if read
>> from the left, little-endian if read from the right, assuming the MSD
>> is to the left) all one needs to know is the endian-ness to be able
>> to figure out the correct value of the number.
>>
>> Why not settle for the simpler definition? Your definition is
>> needlessly clumsy.... and the reading direction DOES matter....
>
> As said, I haven't invented 'any' definition of endian-ness.
> If you have simpler definitions that serves the same
> purpose, it would be nice to let us know. Please state the
> two definitions, the conventional and the one of yours,
> side by side, so that one could clearly see where the
> claimed simplicity is.
"My" definition simply says the number is little-endian if you
read the LSD first, and "big-endian" if you read the MSD first.
There's no need to reconstruct an image of digits on paper -- all
that matters is the order in which you read the digits, not their
position if printed on paper.
So the difference between "my" and "your" method would thus be:
"My" method:
1. Note whether the number is little-endian or big-endian.
2. Read the digits, one by one, and compute the value of the
number while reading the digits. Adjust your algorithm
to whether the number is big-endian or little-endian.
3. When the last digit is read and processed, you have the value
of the number.
"Your" method:
1. Note whether the number is little-endian or big-endian.
2. Note whether you read the number from the left or the right.
3. Read all the digits of the number and remember them all.
4. Reconstruct an image of the number, such that it becomes a
big-endian number if read from the left, thus with the MSD
to the left.
5. When the image of the number is reconstructed, prepare to
read it again as a big-endian number which is to be read
from the left.
6. Read the digits from the left, one by one, and compute the
value of the number while reading the digits. Treat the
number as a big-endian number while computing its value.
7. When the last digit is read and processed, you have the value
of the number.
Now, compare the complexities of the two methods. "Your" method
has an intermediate step where one constructs an image of the
number as if printed on paper. That step isn't necessary at
all (except as a teaching aid perhaps). In "my" method, at no
point one needs to "remember" all the digits in the number:
the digits are consumed, one by one as read, while the partial
result is being built up. When the last digit has been read
and processed, the partial result becomes the final result.
-- ---------------------------------------------------------------- Paul Schlyter, Swedish Amateur Astronomer's Society (SAAF) Grev Turegatan 40, S-114 38 Stockholm, SWEDEN e-mail: pausch at saaf dot se WWW: http://hem.passagen.se/pausch/index.html http://home.tiscali.se/~pausch/
- Next message: Paul Crowley: "Re: Triple AES (3AES)"
- Previous message: Paul Schlyter: "Re: Triple AES (3AES)"
- In reply to: Mok-Kong Shen: "Re: Cohen's paper on byte order"
- Next in thread: Mok-Kong Shen: "Re: Cohen's paper on byte order"
- Reply: Mok-Kong Shen: "Re: Cohen's paper on byte order"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|