From d4d74fda001b9dd82bcc8da8367910195e7803f1 Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Sat, 12 Oct 2024 11:57:25 -0400 Subject: [PATCH] codecs: abs() --> llabs() in speex and libgme We were calling abs() on 64-bit (ie long long) variables. Change-Id: I8326910a4ce733e9e2251aa5f9047e336c8be6df --- lib/rbcodec/codecs/libgme/ym2612_emu.c | 8 ++++---- lib/rbcodec/codecs/speex.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/rbcodec/codecs/libgme/ym2612_emu.c b/lib/rbcodec/codecs/libgme/ym2612_emu.c index 60df30a33c..a904e61e73 100644 --- a/lib/rbcodec/codecs/libgme/ym2612_emu.c +++ b/lib/rbcodec/codecs/libgme/ym2612_emu.c @@ -466,17 +466,17 @@ static void impl_set_rate( struct Ym2612_Impl* impl, int sample_rate, int clock_ { assert( sample_rate ); assert( !clock_rate || clock_rate > sample_rate ); - + int i; // 144 = 12 * (prescale * 2) = 12 * 6 * 2 // prescale set to 6 by default - + int Frequency = (clock_rate ? (int)((FP_ONE_CLOCK * clock_rate) / sample_rate / 144) : (int)FP_ONE_CLOCK); - if ( abs( Frequency - FP_ONE_CLOCK ) < 1 ) + if ( llabs( Frequency - FP_ONE_CLOCK ) < 1 ) Frequency = FP_ONE_CLOCK; impl->YM2612.TimerBase = Frequency; - + /* double Frequence = (double)Frequency / FP_ONE_CLOCK; */ // Tableau TL : diff --git a/lib/rbcodec/codecs/speex.c b/lib/rbcodec/codecs/speex.c index 4d14e83760..3de1e79f51 100644 --- a/lib/rbcodec/codecs/speex.c +++ b/lib/rbcodec/codecs/speex.c @@ -201,11 +201,11 @@ static int speex_seek_page_granule(spx_int64_t pos, spx_int64_t curpos, spx_int64_t avgpagelen = -1; spx_int64_t lastgranule = -1; - if(abs(pos-curpos)>10000 && headerssize>0 && curoffset-headerssize>10000) { + if(llabs(pos-curpos)>10000 && headerssize>0 && curoffset-headerssize>10000) { /* if seeking for more that 10sec, headersize is known & more than 10kb is played, try to guess a place to seek from the number of - bytes playe for this position, this works best when + bytes playe for this position, this works best when the bitrate is relativly constant. */