summaryrefslogtreecommitdiffstats
path: root/sys/dev/sound
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2010-05-04 16:56:59 +0000
committerjkim <jkim@FreeBSD.org>2010-05-04 16:56:59 +0000
commitc0e2f5f6a173f33b55cc1240eb50b7afe9f617b8 (patch)
tree6a84528f567fe97a5a799f66610367f38cee48b4 /sys/dev/sound
parentc9aaa1e2a21afcea58a3bec5e8cffd6652fbaa25 (diff)
downloadFreeBSD-src-c0e2f5f6a173f33b55cc1240eb50b7afe9f617b8.zip
FreeBSD-src-c0e2f5f6a173f33b55cc1240eb50b7afe9f617b8.tar.gz
- Remove more dead code[1]. Since r207330, we only need to check division
by zero of the second argument 'from'. - Prefer u_int32_t over unsigned int to make its intention more clearer. - Move the function to a header file and make it a static inline function. Pointed out by: Andrew Reilly (areilly at bigpond dot net dot au)[1] MFC after: 3 days
Diffstat (limited to 'sys/dev/sound')
-rw-r--r--sys/dev/sound/pcm/buffer.c13
-rw-r--r--sys/dev/sound/pcm/buffer.h12
2 files changed, 11 insertions, 14 deletions
diff --git a/sys/dev/sound/pcm/buffer.c b/sys/dev/sound/pcm/buffer.c
index a9053d7..687542e 100644
--- a/sys/dev/sound/pcm/buffer.c
+++ b/sys/dev/sound/pcm/buffer.c
@@ -566,19 +566,6 @@ sndbuf_updateprevtotal(struct snd_dbuf *b)
}
unsigned int
-snd_xbytes(unsigned int v, unsigned int from, unsigned int to)
-{
-
- if (from == to)
- return v;
-
- if (from == 0 || to == 0 || v == 0)
- return 0;
-
- return (unsigned int)(((u_int64_t)v * to) / from);
-}
-
-unsigned int
sndbuf_xbytes(unsigned int v, struct snd_dbuf *from, struct snd_dbuf *to)
{
if (from == NULL || to == NULL || v == 0)
diff --git a/sys/dev/sound/pcm/buffer.h b/sys/dev/sound/pcm/buffer.h
index 91a63af..d079cdb 100644
--- a/sys/dev/sound/pcm/buffer.h
+++ b/sys/dev/sound/pcm/buffer.h
@@ -111,7 +111,6 @@ u_int64_t sndbuf_getblocks(struct snd_dbuf *b);
u_int64_t sndbuf_getprevblocks(struct snd_dbuf *b);
u_int64_t sndbuf_gettotal(struct snd_dbuf *b);
u_int64_t sndbuf_getprevtotal(struct snd_dbuf *b);
-unsigned int snd_xbytes(unsigned int v, unsigned int from, unsigned int to);
unsigned int sndbuf_xbytes(unsigned int v, struct snd_dbuf *from, struct snd_dbuf *to);
u_int8_t sndbuf_zerodata(u_int32_t fmt);
void sndbuf_updateprevtotal(struct snd_dbuf *b);
@@ -132,3 +131,14 @@ void sndbuf_dmabounce(struct snd_dbuf *b);
#ifdef OSSV4_EXPERIMENT
void sndbuf_getpeaks(struct snd_dbuf *b, int *lp, int *rp);
#endif
+
+static inline u_int32_t
+snd_xbytes(u_int32_t v, u_int32_t from, u_int32_t to)
+{
+
+ if (from == to)
+ return (v);
+ if (from == 0)
+ return (0);
+ return ((u_int64_t)v * to / from);
+}
OpenPOWER on IntegriCloud