]> www.infradead.org Git - users/dwmw2/qemu.git/commitdiff
pcspk: use QEMU_ALIGN_DOWN
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Thu, 22 Jun 2017 11:04:16 +0000 (13:04 +0200)
committerMarc-André Lureau <marcandre.lureau@redhat.com>
Thu, 31 Aug 2017 10:29:07 +0000 (12:29 +0200)
I used the clang-tidy qemu-round check to generate the fix:
https://github.com/elmarco/clang-tools-extra

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
hw/audio/pcspk.c

index f643b122bb10a7bed7cf50d35a31959aff89ecf2..0206f7399bd165e0cf0133dbf45c52bc9bf4e82c 100644 (file)
@@ -69,7 +69,7 @@ static inline void generate_samples(PCSpkState *s)
         const uint32_t n = ((uint64_t)PIT_FREQ << 32) / m;
 
         /* multiple of wavelength for gapless looping */
-        s->samples = (PCSPK_BUF_LEN * PIT_FREQ / m * m / (PIT_FREQ >> 1) + 1) >> 1;
+        s->samples = (QEMU_ALIGN_DOWN(PCSPK_BUF_LEN * PIT_FREQ, m) / (PIT_FREQ >> 1) + 1) >> 1;
         for (i = 0; i < s->samples; ++i)
             s->sample_buf[i] = (64 & (n * i >> 25)) - 32;
     } else {