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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no 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!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!130.59.10.21.MISMATCH!kanaga.switch.ch!switch.ch!newsserver.news.garr.it!newsserver.cilea.it!docenti.ing.unipi.it!o2943499 From: Colin Paul Gloster Newsgroups: comp.lang.ada Subject: Re: How do you bitwise operations in Ada '83 and '95 Date: Fri, 21 Jul 2006 07:23:32 +0200 Organization: CILEA Message-ID: <20060721070023.G88718@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> <1153403384.9119.40.camel@localhost.localdomain> Reply-To: Colin Paul Gloster NNTP-Posting-Host: docenti.ing.unipi.it Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: newsserver.cilea.it 1153459412 24622 131.114.28.20 (21 Jul 2006 05:23:32 GMT) X-Complaints-To: news@cilea.it NNTP-Posting-Date: 21 Jul 2006 05:23:32 GMT X-X-Sender: o2943499@docenti.ing.unipi.it In-Reply-To: <1153403384.9119.40.camel@localhost.localdomain> Xref: g2news2.google.com comp.lang.ada:5848 Date: 2006-07-21T05:23:32+00:00 List-Id: On Thu, 20 Jul 2006, Georg Bauhaus wrote: "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." No, actually you need a subtype for your example but I accept your point is still valid. Uncomment the following comments for a compilation error. procedure Subtype_Instead_Of_Type is type T1 is range 0..19; --type T2 is new T1; subtype ST is T1; V1 : T1; --V2 : T2; V3 : ST; begin V1 := 7; --V2 := V1; V3 := V1; end; "[..] 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 you can and all the platforms you wish to have the program on allow it, it could be done. Another question is, why did the Ada 95 standard and the Ada 2005 standard provide those functions in such a form which is less general than Ada's multiplication and power operators and C's shift operators? " If there is room for even more than 96 bits in modular numbers, [..]" Whereas if the largest Interfaces.Unsigned_n is smaller than needed...