From owner-svn-src-stable@FreeBSD.ORG Mon May 10 19:21:50 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8A10C1065670; Mon, 10 May 2010 19:21:50 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 78B5B8FC1C; Mon, 10 May 2010 19:21:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4AJLoTO044556; Mon, 10 May 2010 19:21:50 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4AJLoBZ044553; Mon, 10 May 2010 19:21:50 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201005101921.o4AJLoBZ044553@svn.freebsd.org> From: Jung-uk Kim Date: Mon, 10 May 2010 19:21:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207879 - stable/8/sys/dev/sound/pcm X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 May 2010 19:21:50 -0000 Author: jkim Date: Mon May 10 19:21:50 2010 New Revision: 207879 URL: http://svn.freebsd.org/changeset/base/207879 Log: MFC: r207330, r207620 - Remove dead code. Calculated greatest common divisor was not used at all. - 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. Modified: stable/8/sys/dev/sound/pcm/buffer.c stable/8/sys/dev/sound/pcm/buffer.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/geom/sched/ (props changed) Modified: stable/8/sys/dev/sound/pcm/buffer.c ============================================================================== --- stable/8/sys/dev/sound/pcm/buffer.c Mon May 10 19:12:23 2010 (r207878) +++ stable/8/sys/dev/sound/pcm/buffer.c Mon May 10 19:21:50 2010 (r207879) @@ -566,30 +566,6 @@ sndbuf_updateprevtotal(struct snd_dbuf * } unsigned int -snd_xbytes(unsigned int v, unsigned int from, unsigned int to) -{ - unsigned int w, x, y; - - if (from == to) - return v; - - if (from == 0 || to == 0 || v == 0) - return 0; - - x = from; - y = to; - while (y != 0) { - w = x % y; - x = y; - y = w; - } - from /= x; - to /= x; - - 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) Modified: stable/8/sys/dev/sound/pcm/buffer.h ============================================================================== --- stable/8/sys/dev/sound/pcm/buffer.h Mon May 10 19:12:23 2010 (r207878) +++ stable/8/sys/dev/sound/pcm/buffer.h Mon May 10 19:21:50 2010 (r207879) @@ -111,7 +111,6 @@ u_int64_t sndbuf_getblocks(struct snd_db 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); +}