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-Thread: 103376,553a6b79b2471571 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!75g2000cwc.googlegroups.com!not-for-mail From: "jimmaureenrogers@worldnet.att.net" Newsgroups: comp.lang.ada Subject: Re: How do you bitwise operations in Ada '83 and '95 Date: 18 Jul 2006 20:55:13 -0700 Organization: http://groups.google.com Message-ID: <1153281313.491512.88760@75g2000cwc.googlegroups.com> References: <1153244316.853254.291560@m79g2000cwm.googlegroups.com> <1153248800.834457.183940@p79g2000cwp.googlegroups.com> <1153258362.266358.15200@h48g2000cwc.googlegroups.com> NNTP-Posting-Host: 69.170.65.169 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1153281318 30760 127.0.0.1 (19 Jul 2006 03:55:18 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 19 Jul 2006 03:55:18 +0000 (UTC) User-Agent: G2/0.2 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.4) Gecko/20060508 Firefox/1.5.0.4,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: 75g2000cwc.googlegroups.com; posting-host=69.170.65.169; posting-account=SqOfxAwAAAAkL81YAPGH1JdBwpUXw9ZG Xref: g2news2.google.com comp.lang.ada:5797 Date: 2006-07-18T20:55:13-07:00 List-Id: Jeffrey R. Carter wrote: > jimmaureenrogers@worldnet.att.net wrote: > > > > I guess that depends upon your definition of bit-wise operations. > > Very few languages support direct indexing of an array of bits. > > The equivalent access operations are a lot of nasty bit masking > > an bit shifting operations. > > Indeed. My definition is bitwise and, or, and the like. Accessing > individual bits is not included (though masking certainly is). I guess > we should ask for the OP's definition. > > However, your example works exactly the same if the array is not packed, > so the fact that the Boolean values are stored as individual bits is a > side effect of your desire to save space by packing the array, not a > need to access individual bits, so I would argue that it is not an > example of bitwise operations, even if accessing individual bits is > included in the definition. Actually it does not work exactly the same. The algorithm is exactly the same, and the same numbers are produced, but the packed array of bits executes faster on my machine by a factor of 3 and uses significantly less space (by a factor of 8). I used a packed array of boolean specifically so that I could store my flags in individual bits. How much more motivation could I have to use individual bits? Your definition of bit-wise appears to me to be based upon the desire to use a low level abstraction to access the bits. My definition includes all abstractions that allow access to individual bits. When I only programmed in C, I only thought of bit-wise access in low level abstractions. Since I have programmed in Ada I think of bit-wise operations in many abstraction levels. One of the virtues of Ada is that it allows me to use the abstraction level most appropriate for my immediate needs when dealing directly with individual bits or groups of bits. Jim Rogers "Bring me a shrub."