comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@bix.com
Subject: Re: First time Ada has let me down
Date: Thu, 26 Oct 2000 06:42:06 GMT
Date: 2000-10-26T06:42:06+00:00	[thread overview]
Message-ID: <2nQJ5.357270$i5.5665339@news1.frmt1.sfba.home.com> (raw)
In-Reply-To: 8t60eo$m0m$1@nnrp1.deja.com

>the length is just len = (*p)&0xf;
>the TCP header length occupies the 4 MSB. the length in this case
>is then  ((*p)&0xf0)>>4;
>Things just have to be easy in C, don't they. No wonder 99.99% of the
  If you really insist on avoiding the tools the language supplies,
a rep clause in this case, and
  "len := buffer(i) mod 16; header_len := buffer(i)/16;"
is insufficiently easy, then how about
   len := len_part(buffer(i)); header_len := Header_len_part(buffer(i));
where
  len_part : constant array(byte) of integer
    := (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
        0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
        ...
        0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
        0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15);
and similarly for header_len_part.  This is quick to write, quick to
execute, puts the definitions in a single place where they can be
changed without finding all the "and 16#0F"s in the program, and
they could even become functions if that became necessary.



  parent reply	other threads:[~2000-10-26  6:42 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-10-25  3:50 First time Ada has let me down Shifty
2000-10-25  0:00 ` First time Ada has let me down (recipe) Guillaume
2000-10-26  2:45   ` Mats Weber
2000-10-25  0:00 ` First time Ada has let me down wv12
2000-10-25  0:00   ` Joel Seidman
2000-10-25  0:00   ` Gisle Sælensminde
2000-10-25  0:00   ` Gautier
2000-10-26  6:42   ` tmoran [this message]
2000-10-25  0:00 ` Larry Kilgallen
2000-10-25  0:00   ` Ted Dennison
2000-10-25  0:00     ` Larry Kilgallen
2000-10-25  0:00       ` Ted Dennison
2000-10-25  0:00 ` Ken Garlington
2000-10-25  0:00   ` Shifty
2000-10-26  4:00     ` Jeff Carter
2000-10-26 14:43       ` Ted Dennison
2000-10-26 17:55         ` tmoran
2000-10-26 17:12       ` Shifty
2000-10-27  1:00         ` Jeff Carter
2000-10-26 22:27       ` Guillaume
2000-10-26 21:49         ` Keith Thompson
2000-10-26 14:36     ` Ted Dennison
2000-10-26 17:55       ` tmoran
2000-10-26 23:08         ` Ted Dennison
2000-10-25  4:44 ` Julian Morrison
2000-10-25  4:50 ` Ted Dennison
2000-10-24  0:00   ` Keith Thompson
2000-10-26  0:00   ` Andreas Schulz
2000-10-26 18:05     ` Alejandro Villanueva
2000-10-26 21:46 ` Tucker Taft
replies disabled

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