From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ded6ba3fc5b87b66 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2000-10-25 23:42:08 PST Path: supernews.google.com!sn-xit-02!sn-xit-03!supernews.com!europa.netcrusader.net!205.252.116.205!howland.erols.net!newshub2.home.com!news.home.com!news1.frmt1.sfba.home.com.POSTED!not-for-mail From: tmoran@bix.com Newsgroups: comp.lang.ada Subject: Re: First time Ada has let me down References: <8t60eo$m0m$1@nnrp1.deja.com> X-Newsreader: Tom's custom newsreader Message-ID: <2nQJ5.357270$i5.5665339@news1.frmt1.sfba.home.com> Date: Thu, 26 Oct 2000 06:42:06 GMT NNTP-Posting-Host: 24.20.190.201 X-Complaints-To: abuse@home.net X-Trace: news1.frmt1.sfba.home.com 972542526 24.20.190.201 (Wed, 25 Oct 2000 23:42:06 PDT) NNTP-Posting-Date: Wed, 25 Oct 2000 23:42:06 PDT Organization: @Home Network Xref: supernews.google.com comp.lang.ada:1567 Date: 2000-10-26T06:42:06+00:00 List-Id: >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.