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,ee7e80feb46de7ac X-Google-Attributes: gid103376,public From: d941686@sp2 (Leong San Io Francisco) Subject: Re: How to perform bit-wise xor, and...? Date: 1996/11/23 Message-ID: <575sqd$3ju@umacss1.umac.mo>#1/1 X-Deja-AN: 198203860 distribution: inet references: <5747oa$svi@umacss1.umac.mo> <1996Nov22.105049.1@eisner> organization: University of Macau newsgroups: comp.lang.ada Date: 1996-11-23T00:00:00+00:00 List-Id: Larry Kilgallen (kilgallen@eisner.decus.org) wrote: : In article <5747oa$svi@umacss1.umac.mo>, d941686@sp2 (Leong San Io Francisco) writes: : > Can someone teach me how to perform bit-wise "xor", and, "or" of two : > integers in Ada so that it can generate code as close as to the underlying : > computer's instructions like the C's ^, &, | operators? I am trying to write : > some computer instructions emulation stuff as well as bitmap graphics : > manipulation which requires "xor", "or" bytes. Is multiplication by 2 really : > equal to shift left and division by integer 2 to shift right? : Someone else may care to go into conversion tricks, but let me just : comment that when you declare something as an integer it specifies : the manner in which you intend to use it. If you find you have a : need to apply logical operations to a numeric, then either: : 1) You were wrong to declare it as an integer : or : 2) Some external definition has horribly overloaded the : meaning of a given location* : This is true for all programming languages, but with Ada the mismatch : is detected and you are alerted to the inconsistency. Other languages : will allow your program to run, and so long as you do not care about : the results of that run, things are much easier than with Ada :-) So, can you give any hints or solution for bitmap manipulation? Thanks. Francisco Leong