9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Michael Yockey myockey@helios.ece.arizona.edu
Subject: seq_within
Date: Wed, 27 Sep 1995 11:51:16 -0400	[thread overview]
Message-ID: <19950927155116.wJ6GM3l7_p4FppBM3imfpvHYOEY3TZKknwIOTWf-dm8@z> (raw)

here's how i interpret the logic of the proposed code:

if low is greater than high, then 'low' assumes the high value, and=20
'high' assumes the low value. (in effect, swap low and high)

> =09=09if(low >=3D x && x >=3D high)

the original executes if:

high is greater than x (x is less than the upper bound)
AND
x is greater than the lower bound=20

so the original executes if x is within the desired range.

(remember i am swapping low and high because of the assumption low>high)
the proposed change executes if:

> =09=09if(x >=3D low || x <=3D high)

x is greater than the upper bound=20
OR
x is less than the lower bound

so the proposed change executes if x is outside the range set by high and=
=20
low.  (remember the assumption that low > high)

i don't know enough to know what this code is for (or does!) but i hope=20
my interpretation does some good.

Mike

Mike Yockey=09=09=09myockey@ece.arizona.edu
UNIX System Administrator=09Electrical and Computer Engineering Department
The University of Arizona=09Tucson, Arizona
page me: page_mike@vanzandt.amd.com
"Madness takes its toll.  Please have exact change."
*** This message contains a minimum of 15% post-consumer electrons. ***

On Tue, 26 Sep 1995 forsyth@plan9.cs.york.ac.uk wrote:

> does anyone else think the definition of seq_within in /sys/src/9/port/tc=
pinput.c
> is wrong?  i think the test when low > high should be
> =09=09if(x >=3D low || x <=3D high)
> not
> =09=09if(low >=3D x && x >=3D high)
>=20
> i think as it stands it is checking the wrong interval.  consider its app=
lication in
>=20
> =09seq_within(seg.ack, tcb->snd.una+1, tcb->snd.nxt)
>=20
>=20
> tcb->snd.una+1 > tcb->snd.nxt when the sequence numbers have wrapped roun=
d zero,
> increasing from tcb->snd.una+1 past ~0 to 0 then on to tcb->snd.nxt.
> in other words, the valid ack sequence numbers are those in
> =09[tcb->snd.una+1, ~0] =E2=88=AA [0, tcb->snd.nxt]
> not (as seq_within currently has it) those in
> =09[tcb->snd.nxt, tcb->snd.una+1]
>=20
>=20
>=20






             reply	other threads:[~1995-09-27 15:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-09-27 15:51 Michael [this message]
  -- strict thread matches above, loose matches on Subject: below --
1995-09-26 22:09 seq_within forsyth

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=19950927155116.wJ6GM3l7_p4FppBM3imfpvHYOEY3TZKknwIOTWf-dm8@z \
    --to=9fans@9fans.net \
    /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).