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,1048aea26a740e29 X-Google-Attributes: gid103376,public From: Robert Dewar Subject: Re: Bit operators Date: 2000/02/13 Message-ID: <886feg$qgr$1@nnrp1.deja.com>#1/1 X-Deja-AN: 585248775 References: <884o85$jjv$1@news.fsu.edu> X-Http-Proxy: 1.0 x40.deja.com:80 (Squid/1.1.22) for client 205.232.38.14 Organization: Deja.com - Before you buy. X-Article-Creation-Date: Sun Feb 13 14:34:56 2000 GMT X-MyDeja-Info: XMYDJUIDrobert_dewar Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.61 [en] (OS/2; I) Date: 2000-02-13T00:00:00+00:00 List-Id: In article <884o85$jjv$1@news.fsu.edu>, grant@cs.fsu.edu (Joshua Grant) wrote: > I was recently assigned a project for one of my classes that gave us the > option of implementing a simplified MIPS assempler in any preferred higher > level language. I have choosen ADA, but I am running into a problem with > the bit operators. I can't find them! In case someone isn't sure of my > question. In C++ if you perform an 'and' operation with the '&' > operator like... All the answers you got were inappropriate (a not uncommon occurrence around here :-) :-) You approached the problem with a "how-do-I-write-C-in-Ada" viewpoint, and three people answered you to tell you how :-) But the proper answer is to use the features of Ada that allow this to be done nicely without such nasty low level gizmos. MIPS assembly instructions have a very regular format, there are only a very few instruction formats. For each of these define a record type, with nicely typed fields and then use a record representation clause to lay out the record in a manner that matches the MIPS layouts (you may have to worry about endian considerations here, but the same is true using the low level C approach anyway). Now you assign to the fields of this record with full type checking, e.g. if you try to put an immediate value in a register field, you will get a compile time error. There is no point in writing C in Ada, if you want to write C, write C in C, it is less trouble :-) Sent via Deja.com http://www.deja.com/ Before you buy.