home *** CD-ROM | disk | FTP | other *** search
- Path: hp62.rbg.informatik.th-darmstadt.de!meixner
- From: meixner@rbg.informatik.th-darmstadt.de (Matthias Meixner)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: PPC compilers
- Date: 12 Jan 1996 12:31:10 GMT
- Organization: Technische Hochschule Darmstadt
- Message-ID: <4d5kae$24rg@rs18.hrz.th-darmstadt.de>
- References: <john.hendrikx.40ka@grafix.xs4all.nl> <MQAQx*XOe@yaps.rhein.de> <OWhVx*42f@yaps.rhein.de> <4cuhng$dmn@maureen.teleport.com> <jasonb.821247870@cs.uwa.edu.au> <4d359i$ii7$1@sydney.DIALix.oz.au>
- NNTP-Posting-Host: hp62.rbg.informatik.th-darmstadt.de
- X-Newsreader: TIN [version 1.2 PL2]
-
- Troy Till (accolyte@sydney.DIALix.oz.au) wrote:
- : Bear with me here, 'cause I don't know the second thing about C..
-
- : can you do something to the equivalent of:
-
- : addx.l d0,d1
- : move.w d1,d2
-
- : Which is treating d1 as a long word, then a word. How would you implement
- : this in C?
-
-
- struct words {
- short high,low;
- };
-
- union mixed {
- long a_l;
- struct words a_w;
- };
-
-
- function() {
- union mixed variable;
- short x;
-
- variable.a_l+=10; /* now this is a long */
-
- x=variable.a_w.low; /* now the same amount of memory is treated as a short */
- }
-
- However in the above case, you would just assign a longword to the word and
- the compiler would do the conversion (i.e. in the case it would do e.g. move.w d1,d2)
-
- long a;
- short b;
-
- b=a;
-
-
- : Troy.
-
- --
-
- - Matthias Meixner
-
- -----------------------------------------------------------------------------
- EMail: meixner@rbg.informatik.th-darmstadt.de
- WWW: http://www.student.informatik.th-darmstadt.de/~meixner/
-
- Uebrigens: Nachts gehen Sonnenuhren nach dem Mond ...
-
-
-
-