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,8309f2bc055237c4 X-Google-Attributes: gid103376,public From: Redryder Subject: Re: Bit manipulation Date: 2000/11/11 Message-ID: <3A0D38E9.BB87D8CD@mindspring.com>#1/1 X-Deja-AN: 692366383 Content-Transfer-Encoding: 7bit References: <8u8v6n$b7o$1@nnrp1.deja.com> <2WTH$pdrCfOd@eisner.decus.org> <8ub6kt$6nd$1@nnrp1.deja.com> <8ubeq8$cgm$1@nnrp1.deja.com> X-Accept-Language: en X-Server-Date: 11 Nov 2000 12:25:09 GMT Content-Type: text/plain; charset=us-ascii Organization: MindSpring Enterprises Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 2000-11-11T12:25:09+00:00 List-Id: Hey, I have another question concerning bit manipulation. I need to swap the bits in a 32-bit word. I used a packed boolean array. It works well enough, but it does require looping over the array indices. Is there a better way to do this? Oh, I've framed the task correctly! This is in a serial message that goes to a "legacy" system requiring that the bits are swapped. I have more than 40 different messages each having similar bit fields in the message. Still, the bit fields are not the same width or position from message to message. There are a number of them that change position and meaning. I've been using Ada for a year or so now. I was using C/C++. Personally, if you are looking for safe code, I think Ada95 is a good answer. John