From 4134ebd95d1dffb578a4eb5e02ec404decf32ea4 Mon Sep 17 00:00:00 2001 From: boolemancer Date: Sun, 8 Jan 2023 04:31:03 -0800 Subject: [PATCH] Do calculation with 64 bit precision to avoid overflow --- whisper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/whisper.cpp b/whisper.cpp index 433b735..5da6760 100644 --- a/whisper.cpp +++ b/whisper.cpp @@ -3387,7 +3387,7 @@ static int timestamp_to_sample(int64_t t, int n_samples) { return std::max(0, std::min((int) n_samples - 1, (int) ((t*WHISPER_SAMPLE_RATE)/100))); } -static int64_t sample_to_timestamp(int i_sample) { +static int64_t sample_to_timestamp(int64_t i_sample) { return (100*i_sample)/WHISPER_SAMPLE_RATE; }