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!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!newsfeed.freenet.de!newsfeed01.chello.at!newsfeed.arcor.de!news.arcor.de!not-for-mail Newsgroups: comp.lang.ada Subject: Re: How do you bitwise operations in Ada '83 and '95 From: Georg Bauhaus In-Reply-To: <20060720145730.F9651@docenti.ing.unipi.it> References: <9315684D-C216-4EDA-8852-0A6BD4C275B0@amado-alves.info> <44bf3301$0$10529$9b4e6d93@newsread4.arcor-online.net> <20060720112346.C65387@docenti.ing.unipi.it> <1153398718.9119.12.camel@localhost.localdomain> <20060720145730.F9651@docenti.ing.unipi.it> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: # Message-ID: <1153403384.9119.40.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.4.1 Date: Thu, 20 Jul 2006 15:49:45 +0200 NNTP-Posting-Date: 20 Jul 2006 15:49:21 MEST NNTP-Posting-Host: 619561c0.newsread2.arcor-online.net X-Trace: DXC=e4X6MLBg]dHUhhl_USDNiOQ5U85hF6f;DjW\KbG]kaMHGSi?jHD8GO@bhB_5>e5c6LhP3YJKgE\jLi^3YIPCKQDI`J7J On Thu, 2006-07-20 at 15:08 +0200, Colin Paul Gloster wrote: > the returned value from function > Shift_Left (Value : Unsigned_96; Amount : Natural) return Unsigned_96 > can not be assigned to a variable of type Time is mod 2 ** 96 without > conversion. type Time is new Unsigned_96; In fact, type Time is private; and then the above. > As another example, suppose one did not have type Time and wanted > Interfaces.Unsigned_96 but Interfaces.Unsigned_96 did not exist in one > particular implementation but e.g. Interfaces.Unsigned_128 did. The code > relying on Interfaces.Unsigned_96 would not work on that implementation. OK, that is a good point when the program is operating on modular numbers or bit sets. But if an algorithm is about shifting bits really, then why not use the subprograms that say "Shift_zzzz" in their names, and that were made for shifting bits? If there is room for even more than 96 bits in modular numbers, I'd say that "easily ported" (from a 96 bit system to a 128 bit system) is a better description than "unportable". I guess for the "*" -> shift optimization to work in the general case, the **2 factors will have to be statically known anyway. (They are, in MAA's program.)