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,78b2880bc7e78e39 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-03-14 17:38:25 PST Path: supernews.google.com!sn-xit-02!supernews.com!news.gv.tsc.tdk.com!falcon.america.net!sunqbc.risq.qc.ca!newsfeed.mathworks.com!cpk-news-hub1.bbnplanet.com!bstnma1-snf1.gtei.net!news.gtei.net!USEAST.RATIONAL.com NNTP-Posting-Host: 172.20.21.30 Newsgroups: comp.lang.ada Date: Wed, 14 Mar 2001 20:30:25 -0500 Message-ID: From: "Corey Ashford" References: <3AAFE967.44BAEDAD@averstar.com> Subject: Re: RISC X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2919.6700 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 Xref: supernews.google.com comp.lang.ada:5746 Date: 2001-03-14T20:30:25-05:00 List-Id: "Fraser Wilson" wrote in message news:fy7y9u8hs24.fsf@whitelion.org... > "chris.danx" writes: > > > * procedure set_data (reg : in out register; > > * data : in word) is > > * begin > > * -- and this! > > * reg.data := ((reg.data / 65536) * 65536) xor long_word(data); > > * end set_data; > > > If that's inefficient, what about > As a side note, I would bet that most compilers would optimize the line above to (using C shift terminology): reg.data := ((reg.data >> 16) << 16) xor long_word(data); I know the Apex compiler would. If the divisor and/or multiplier are not numbers or named numbers, then the compiler would not be able to do that optimization, however. Similarly, a mod operation with a number that's a power of two would be optimized to an AND operation with the proper mask. - Corey > reg.data := (reg.data and 16#FFFF0000) or register_block (data); > > > * -- i've got to improve the efficiency of this; > > * reg.data := ((reg.data / 256) * 256 ) xor register_block(data); > > Similarly, > reg.data := (reg.data and 16#FFFFFF00#) or register_block (data); > > Fraser.