]> err.no Git - linux-2.6/commitdiff
[ALSA] Fix compilation on 32bit arch
authorTakashi Iwai <tiwai@suse.de>
Fri, 27 May 2005 10:40:52 +0000 (12:40 +0200)
committerJaroslav Kysela <perex@suse.cz>
Sun, 29 May 2005 08:15:30 +0000 (10:15 +0200)
ALSA<-OSS emulation
Fix the division with int64 for 32bit architectures.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/core/oss/pcm_oss.c

index 131522ea4b935a87075e165ab1549607e4ac9ff1..468fca8894d9d0ab4fb442fb0fe835fb70ed7301 100644 (file)
@@ -129,7 +129,16 @@ static long snd_pcm_oss_bytes(snd_pcm_substream_t *substream, long frames)
        long bytes = frames_to_bytes(runtime, frames);
        if (buffer_size == runtime->oss.buffer_bytes)
                return bytes;
-       return (long)(((int64_t)runtime->oss.buffer_bytes * (int64_t)bytes) / (int64_t)buffer_size);
+#if BITS_PER_LONG >= 64
+       return runtime->oss.buffer_bytes * bytes / buffer_size;
+#else
+       {
+               u64 bsize = (u64)runtime->oss.buffer_bytes * (u64)bytes;
+               u32 rem;
+               div64_32(&bsize, buffer_size, &rem);
+               return (long)bsize;
+       }
+#endif
 }
 
 static long snd_pcm_alsa_frames(snd_pcm_substream_t *substream, long bytes)