home *** CD-ROM | disk | FTP | other *** search
- Path: ar.ar.com.au!not-for-mail
- From: storm@ar.ar.com.au (Storm)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: PPC compilers
- Date: 20 Jan 1996 07:34:36 +1100
- Organization: I need to put my ORGANIZATION here.
- Distribution: world
- Message-ID: <4dov8s$rc5@ar.ar.com.au>
- 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> <4d42gg$i2p@ra.ibr.cs.tu-bs.de>
- NNTP-Posting-Host: ar.ar.com.au
- X-Newsreader: TIN [UNIX 1.3 941216BETA PL0]
-
- Lars Duening (duening@ibr.cs.tu-bs.de) wrote:
- : accolyte@sydney.DIALix.oz.au (Troy Till) writes:
- : >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?
-
- : I'd try (int16)((int32)a+(int32)b) with int16 and int32 appropriately
- : defined.
-
- : But the question is: why should I treat d1 as long in the addition,
- : when just the lower word is used afterwards?
-
- To do fast 16:16 bit fixed point maths (ie for bitmap scaling). You have the
- fraction in the high word and the integer part in the low word. Because of
- the addx, every time the fraction wraps around, the X bit is set and next
- add, the integer bit is incremented.
-
- Of course you only wish to use the integer bit so only the low word of d1
- is moved to d2.
-
- -- ______________________________
- \_/ "\/\/\__"\/ "\/ "\/\__"\_/
- Storm / Cydonia / / / / / / / / / / / / ' / Packing class
- / /\/> / / / / / / / / / /__ & kicking arse!
- (coder) \__/ \_/\__/\__/\/\/\/\/\/ \/
-