diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-06-10 07:26:28 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-06-10 07:26:28 +0200 |
commit | 19b1a15a3de2b3b6367c968e65bffe9503556ef1 (patch) | |
tree | bd87869290924ac3fee2126e5ba3aa668dde5d09 /include/sound | |
parent | e618a5609e504845786c71e2825e10b6a9728185 (diff) | |
parent | 3f7440a6b771169e1f11fa582e53a4259b682809 (diff) | |
download | linux-19b1a15a3de2b3b6367c968e65bffe9503556ef1.tar.gz linux-19b1a15a3de2b3b6367c968e65bffe9503556ef1.tar.bz2 linux-19b1a15a3de2b3b6367c968e65bffe9503556ef1.zip |
Merge branch 'topic/div64-cleanup' into for-linus
* topic/div64-cleanup:
ALSA: Clean up 64bit division functions
Diffstat (limited to 'include/sound')
-rw-r--r-- | include/sound/pcm.h | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/include/sound/pcm.h b/include/sound/pcm.h index c17296891617..0caf71e16944 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h @@ -486,80 +486,6 @@ void snd_pcm_detach_substream(struct snd_pcm_substream *substream); void snd_pcm_vma_notify_data(void *client, void *data); int snd_pcm_mmap_data(struct snd_pcm_substream *substream, struct file *file, struct vm_area_struct *area); -#if BITS_PER_LONG >= 64 - -static inline void div64_32(u_int64_t *n, u_int32_t div, u_int32_t *rem) -{ - *rem = *n % div; - *n /= div; -} - -#elif defined(i386) - -static inline void div64_32(u_int64_t *n, u_int32_t div, u_int32_t *rem) -{ - u_int32_t low, high; - low = *n & 0xffffffff; - high = *n >> 32; - if (high) { - u_int32_t high1 = high % div; - high /= div; - asm("divl %2":"=a" (low), "=d" (*rem):"rm" (div), "a" (low), "d" (high1)); - *n = (u_int64_t)high << 32 | low; - } else { - *n = low / div; - *rem = low % div; - } -} -#else - -static inline void divl(u_int32_t high, u_int32_t low, - u_int32_t div, - u_int32_t *q, u_int32_t *r) -{ - u_int64_t n = (u_int64_t)high << 32 | low; - u_int64_t d = (u_int64_t)div << 31; - u_int32_t q1 = 0; - int c = 32; - while (n > 0xffffffffU) { - q1 <<= 1; - if (n >= d) { - n -= d; - q1 |= 1; - } - d >>= 1; - c--; - } - q1 <<= c; - if (n) { - low = n; - *q = q1 | (low / div); - *r = low % div; - } else { - *r = 0; - *q = q1; - } - return; -} - -static inline void div64_32(u_int64_t *n, u_int32_t div, u_int32_t *rem) -{ - u_int32_t low, high; - low = *n & 0xffffffff; - high = *n >> 32; - if (high) { - u_int32_t high1 = high % div; - u_int32_t low1 = low; - high /= div; - divl(high1, low1, div, &low, rem); - *n = (u_int64_t)high << 32 | low; - } else { - *n = low / div; - *rem = low % div; - } -} -#endif - /* * PCM library */ |