Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Usage of UnsignedFixed type



Hi Brad, Hi Jan,

as I mentioned, I'm aware of Fix2Long (and also FixMath.h) . Unfortunately Fix2Long works only for positive numbers smaller than 32767, as it is limited by the signedness.
But the part of an UnsignedFixed is not the problem, as you just can shift by 16 bits (or divide by 2^16).

As Jan stated,  the macro

> #define Float64ToUnsignedFixed(f64SampleRate) ((UnsignedFixed)
> (((f64SampleRate) * 65536.0) + 0.5))

uses fraction. I missed, that the multiplication is done with floating point precision...

Therefore I suppose, you can calculate the fraction part of an UnsignedFixed with something like

#define FractionOfUnsignedFixed(
f64SampleRate) (((Float64) ( (f64SampleRate) & 0xffff)) / 65536 )

Is that correct ?

Thanks,
Martin






 _______________________________________________
Do not post admin requests to the list. They will be ignored.
QuickTime-API mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quicktime-api/email@hidden

This email sent to email@hidden

References: 
 >Usage of UnsignedFixed type (From: "Martin Wilz" <email@hidden>)
 >Re: Usage of UnsignedFixed type (From: Brad Ford <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.