From: random832@fastmail.com (Random832)
Subject: [TUHS] why is sum reporting different checksum's between v6 and v7
Date: Fri, 11 Dec 2015 20:46:28 -0500 [thread overview]
Message-ID: <m2r3is5thn.fsf@fastmail.com> (raw)
In-Reply-To: <20151212012257.3740418C0AA@mercury.lcs.mit.edu>
Noel Chiappa writes:
> No, I don't think so, depending on the exact detals of the implementation. As
> long as when folding the two halves together, you add any carry into the sum,
> you get the same result as doing it into a 16-bit sum.
The issue I was suggesting comes if you've lost carry bits
_before_ folding the two halves together, when you were working
in 32-bit arithmetic.
> (If my memory of how
> this all works is correct - the neurons aren't what they used to be,
> especially late in the day... :-)
>
> > Also, if this sign extends, then its behavior on "negative" (high bit
> > set) bytes is likely to be very different from the SysIII one, which
> > uses getc.
>
> I have this bit set that in C, 'char' is defined to be signed
The SysIII sum.c file uses getc and stores the result in an int,
not a char.
I *think* the definition of getc returns positive values the
same as modern systems do, despite the manpage's caution to
check feof because EOF is a "valid integer value":
#define getc(p) (--(p)->_cnt>=0? *(p)->_ptr++&0377:_filbuf(p))
_filbuf also has & 0377 in the relevant place.
If getc returns negative values for high-bit characters, on the
other hand, then they would sign-extend to 32 bits when the long
math is done, still yielding different results.
next prev parent reply other threads:[~2015-12-12 1:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-12 1:22 Noel Chiappa
2015-12-12 1:46 ` Random832 [this message]
2015-12-12 1:50 ` John Cowan
-- strict thread matches above, loose matches on Subject: below --
2015-12-12 0:30 Noel Chiappa
2015-12-12 1:07 ` Random832
2015-12-12 0:03 Will Senn
2015-12-12 0:10 ` Clem cole
2015-12-12 0:38 ` Random832
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2r3is5thn.fsf@fastmail.com \
--to=random832@fastmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).