From 19b2edfc4b75a89e969ad2c9042a5ca12b3949c9 Mon Sep 17 00:00:00 2001 From: Intel A80486DX2-66 Date: Tue, 9 Jan 2024 18:37:32 +0300 Subject: [PATCH] template.c: extract/optimize `BIT_DEPTH / 8` --- src/template.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/template.c b/src/template.c index 04cce99..371a99b 100644 --- a/src/template.c +++ b/src/template.c @@ -142,6 +142,10 @@ main(void) bit_depth_limiter = BIT_DEPTH_LIMITER #if FP_RETURN_TYPE + 1 +#endif +#if BIT_DEPTH < 8 + , + bit_depth_stretch = ((long double) BIT_DEPTH) / 8.L #endif ; @@ -164,7 +168,7 @@ main(void) // 4. if bit depth is less than 8, stretch it #if BIT_DEPTH < 8 sample_res = (SAMPLE_TYPE) - ((long double) sample_res * ((long double) BIT_DEPTH / 8.L)); + ((long double) sample_res * bit_depth_stretch); #endif // 5. save sample into buffer