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,8309f2bc055237c4 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2000-11-11 22:40:26 PST Path: supernews.google.com!sn-xit-02!sn-xit-01!supernews.com!feeder.qis.net!nntp.abs.net!newshub2.home.com!news.home.com!news1.frmt1.sfba.home.com.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: Bit manipulation References: <3A0E3116.83AEC906@acm.org> X-Newsreader: Tom's custom newsreader Message-ID: Date: Sun, 12 Nov 2000 06:40:25 GMT NNTP-Posting-Host: 24.20.190.201 X-Complaints-To: abuse@home.net X-Trace: news1.frmt1.sfba.home.com 974011225 24.20.190.201 (Sat, 11 Nov 2000 22:40:25 PST) NNTP-Posting-Date: Sat, 11 Nov 2000 22:40:25 PST Organization: @Home Network Xref: supernews.google.com comp.lang.ada:2039 Date: 2000-11-12T06:40:25+00:00 List-Id: >I take it you want the resulting bit pattern to be the reverse of the >original bit pattern. >... >The fastest but most space-consuming solution would use a look-up table. Swap parts and use a lookup table to swap bits within those parts, eg: type Bytes is mod 256; type Reversibles is array(1 .. 4) of Bytes; Xlate : constant array(Bytes) of Bytes := (16#00000000#,16#10000000#,16#01000000#,16#11000000#, 16#00100000#,16#10100000#,16#01100000#,16#11100000#, 16#00010000#,16#10010000#,16#01010000#,16#11010000#, 16#00110000#,16#10110000#,16#01110000#,16#11110000#, 16#00001000#,16#10001000#,16#01001000#,16#11001000#, 16#00101000#,16#10101000#,16#01101000#,16#11101000#, 16#00011000#,16#10011000#,16#01011000#,16#11011000#, 16#00111000#,16#10111000#,16#01111000#,16#11111000#, 16#00000100#,16#10000100#,16#01000100#,16#11000100#, 16#00100100#,16#10100100#,16#01100100#,16#11100100#, 16#00010100#,16#10010100#,16#01010100#,16#11010100#, 16#00110100#,16#10110100#,16#01110100#,16#11110100#, 16#00001100#,16#10001100#,16#01001100#,16#11001100#, 16#00101100#,16#10101100#,16#01101100#,16#11101100#, 16#00011100#,16#10011100#,16#01011100#,16#11011100#, 16#00111100#,16#10111100#,16#01111100#,16#11111100#, 16#00000010#,16#10000010#,16#01000010#,16#11000010#, 16#00100010#,16#10100010#,16#01100010#,16#11100010#, 16#00010010#,16#10010010#,16#01010010#,16#11010010#, 16#00110010#,16#10110010#,16#01110010#,16#11110010#, 16#00001010#,16#10001010#,16#01001010#,16#11001010#, 16#00101010#,16#10101010#,16#01101010#,16#11101010#, 16#00011010#,16#10011010#,16#01011010#,16#11011010#, 16#00111010#,16#10111010#,16#01111010#,16#11111010#, 16#00000110#,16#10000110#,16#01000110#,16#11000110#, 16#00100110#,16#10100110#,16#01100110#,16#11100110#, 16#00010110#,16#10010110#,16#01010110#,16#11010110#, 16#00110110#,16#10110110#,16#01110110#,16#11110110#, 16#00001110#,16#10001110#,16#01001110#,16#11001110#, 16#00101110#,16#10101110#,16#01101110#,16#11101110#, 16#00011110#,16#10011110#,16#01011110#,16#11011110#, 16#00111110#,16#10111110#,16#01111110#,16#11111110#, 16#00000001#,16#10000001#,16#01000001#,16#11000001#, 16#00100001#,16#10100001#,16#01100001#,16#11100001#, 16#00010001#,16#10010001#,16#01010001#,16#11010001#, 16#00110001#,16#10110001#,16#01110001#,16#11110001#, 16#00001001#,16#10001001#,16#01001001#,16#11001001#, 16#00101001#,16#10101001#,16#01101001#,16#11101001#, 16#00011001#,16#10011001#,16#01011001#,16#11011001#, 16#00111001#,16#10111001#,16#01111001#,16#11111001#, 16#00000101#,16#10000101#,16#01000101#,16#11000101#, 16#00100101#,16#10100101#,16#01100101#,16#11100101#, 16#00010101#,16#10010101#,16#01010101#,16#11010101#, 16#00110101#,16#10110101#,16#01110101#,16#11110101#, 16#00001101#,16#10001101#,16#01001101#,16#11001101#, 16#00101101#,16#10101101#,16#01101101#,16#11101101#, 16#00011101#,16#10011101#,16#01011101#,16#11011101#, 16#00111101#,16#10111101#,16#01111101#,16#11111101#, 16#00000011#,16#10000011#,16#01000011#,16#11000011#, 16#00100011#,16#10100011#,16#01100011#,16#11100011#, 16#00010011#,16#10010011#,16#01010011#,16#11010011#, 16#00110011#,16#10110011#,16#01110011#,16#11110011#, 16#00001011#,16#10001011#,16#01001011#,16#11001011#, 16#00101011#,16#10101011#,16#01101011#,16#11101011#, 16#00011011#,16#10011011#,16#01011011#,16#11011011#, 16#00111011#,16#10111011#,16#01111011#,16#11111011#, 16#00000111#,16#10000111#,16#01000111#,16#11000111#, 16#00100111#,16#10100111#,16#01100111#,16#11100111#, 16#00010111#,16#10010111#,16#01010111#,16#11010111#, 16#00110111#,16#10110111#,16#01110111#,16#11110111#, 16#00001111#,16#10001111#,16#01001111#,16#11001111#, 16#00101111#,16#10101111#,16#01101111#,16#11101111#, 16#00011111#,16#10011111#,16#01011111#,16#11011111#, 16#00111111#,16#10111111#,16#01111111#,16#11111111#); function Swap (X : REVERSIBLES) return REVERSIBLES is begin return (Xlate(X(4)), Xlate(X(3)), Xlate(X(2)), Xlate(X(1))); end Swap;