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, MSGID_RANDY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8309f2bc055237c4 X-Google-Attributes: gid103376,public From: Robert Dewar Subject: Re: Bit manipulation Date: 2000/11/13 Message-ID: <8up1ql$uuj$1@nnrp1.deja.com>#1/1 X-Deja-AN: 693091535 References: <8u8v6n$b7o$1@nnrp1.deja.com> <2WTH$pdrCfOd@eisner.decus.org> <8ub6kt$6nd$1@nnrp1.deja.com> <8ubeq8$cgm$1@nnrp1.deja.com> <3A0D38E9.BB87D8CD@mindspring.com> <8uoqi1$oqi$1@nnrp1.deja.com> X-Http-Proxy: 1.0 x64.deja.com:80 (Squid/1.1.22) for client 205.232.38.240 Organization: Deja.com - Before you buy. X-Article-Creation-Date: Mon Nov 13 15:36:54 2000 GMT X-MyDeja-Info: XMYDJUIDrobert_dewar Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.61 [en] (OS/2; I) Date: 2000-11-13T00:00:00+00:00 List-Id: In article , lutz@iks-jena.de (Lutz Donnerhacke) wrote: > This piece of code is from my play and experimental grounds. > I'd prefer a portable solution instead of mapping maschine > code into a portability lib. No no no! Rotate_Left is a function defined IN THE ADA 95 RM, it is a high level function that is defined at the Ada semantic level. Yes, it will translate to some efficient sequence of machine instructions (a single rotate instruction, where such exists, some equivalent clever sequence where it does not). There is absolutely NO need EVER to do roll-your-own rotates in Ada 95. As I say, this is not exactly obscure, if you look up rotate in the RM index, you will find the reference. One note here. In the RM, Rotate_Left and Rotate_Right are defined only on the types in Interfaces, which is a bit limiting, but for portability across compilers you have to stick to this. In GNAT, we permit the definition of an intrinsic (using pragma Import (Intrinsic,Rotate_xxx)) Rotate_Left/Right for any user defined modular type, but this is not necessarily portable (this is actually something the ARG should add as a recommended enhancement, since it is hard to imagine any compiler would find it hard to do). Sent via Deja.com http://www.deja.com/ Before you buy.