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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c7d533acec91ae16 X-Google-Attributes: gid103376,public From: Keith Thompson Subject: Re: Question for the folks who designed Ada95 Date: 1999/04/28 Message-ID: #1/1 X-Deja-AN: 472065289 References: <7g2qu4$ca4$1@usenet.rational.com> <3725F4F1.7B615767@rocketmail.com> X-Complaints-To: usenet@nusku.cts.com X-Trace: nusku.cts.com 925342134 19160 198.68.168.21 (28 Apr 1999 23:28:54 GMT) Organization: CTS Network Services NNTP-Posting-Date: 28 Apr 1999 23:28:54 GMT Newsgroups: comp.lang.ada Date: 1999-04-28T23:28:54+00:00 List-Id: Robert A Duff writes: [...] > We didn't think it was necessary -- you can always multiply by 2 or > whatever. Optimizing that to a shift instruction is trivial, and if you > care about efficiency, surely you should be using an optimizing compiler > that is *at least* that smart. (After all, I want that optimization for > signed integers, too!) That's fine if the size of the shift is a constant, but as someone else has pointed out, it's more difficult if it's a variable. I suppose a compiler could optimize X := X * 2**N; to a shift instruction, but I'd hate to have to depend on it. > It's not clear what shifting should mean if the modulus is not a power > of 2. Robert has stated many times that that should never have been > allowed, and I tend to agree. Do you mean that shifting should not be allowed for such types, or that the types themselves should not be allowed? Either way, I also tend to agree. Non-power-of-two modular types remind me of enumeration representation clauses -- something that was added for the sake of completeness, but that's more trouble to define and implement than it's really worth. If non-power-of-two modular types are really worth having in the language, it might have been nice to make them a distinct class of type, like decimal fixed-point vs. ordinary fixed-point. That would allow providing shifts as attributes without running into generic contract model problems. I think. Disclaimer: I've been mostly out of touch with Ada for the last couple of years, so I've probably made some mistakes. -- Keith Thompson (The_Other_Keith) kst@cts.com San Diego Supercomputer Center <*> Techno-geek. Mouse bigger than phone. Bites heads off virtual chickens.