forked from len0rd/rockbox
Fix division by 0 by clamping freq value a little higher, some minor style and whitespace changes
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23850 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
f443d026ec
commit
f76b5d5490
1 changed files with 11 additions and 12 deletions
|
@ -118,7 +118,7 @@ typedef struct _fixed fixed;
|
|||
#define fp_data(x) ((x).a)
|
||||
#define fp_frac(x) (fp_sub((x), int2fixed(fixed2int(x))))
|
||||
#define FP_ZERO ((fixed){0})
|
||||
#define FP_LOW ((fixed){1})
|
||||
#define FP_LOW ((fixed){2})
|
||||
|
||||
/* Some defines for converting between period and frequency */
|
||||
|
||||
|
@ -758,10 +758,9 @@ void display_frequency (fixed freq)
|
|||
nfreq = notes[note].freq;
|
||||
while (fp_gt(fp_div(nfreq, freq), D_NOTE_SQRT))
|
||||
nfreq = fp_shr(nfreq, 1);
|
||||
|
||||
while (fp_gt(fp_div(freq, nfreq), D_NOTE_SQRT))
|
||||
{
|
||||
nfreq = fp_shl(nfreq, 1);
|
||||
}
|
||||
|
||||
ldf = fp_mul(int2fixed(1200), log(fp_div(freq,nfreq)));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue