From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Wed, 27 Sep 1995 11:51:16 -0400 From: Michael Yockey myockey@helios.ece.arizona.edu Subject: seq_within Topicbox-Message-UUID: 28685e18-eac8-11e9-9e20-41e7f4b1d025 Message-ID: <19950927155116.wJ6GM3l7_p4FppBM3imfpvHYOEY3TZKknwIOTWf-dm8@z> 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