Module Name:    src
Committed By:   nat
Date:           Mon Jun 26 11:45:46 UTC 2017

Modified Files:
        src/sys/dev: mulaw.c

Log Message:
Rectify an error in mulaw/alaw conversion to big endian.  The atf audio
test should pass on sparc again.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/mulaw.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mulaw.c
diff -u src/sys/dev/mulaw.c:1.30 src/sys/dev/mulaw.c:1.31
--- src/sys/dev/mulaw.c:1.30	Sun Jun 25 02:16:41 2017
+++ src/sys/dev/mulaw.c	Mon Jun 26 11:45:46 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mulaw.c,v 1.30 2017/06/25 02:16:41 nat Exp $	*/
+/*	$NetBSD: mulaw.c,v 1.31 2017/06/26 11:45:46 nat Exp $	*/
 
 /*
  * Copyright (c) 1991-1993 Regents of the University of California.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mulaw.c,v 1.30 2017/06/25 02:16:41 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mulaw.c,v 1.31 2017/06/26 11:45:46 nat Exp $");
 
 #include <sys/types.h>
 #include <sys/systm.h>
@@ -324,7 +324,7 @@ DEFINE_FILTER(mulaw_to_linear##n_prec)		
 			j = hw - 2;					\
 			d[0] = mulawtolin16[s[0]][0];			\
 			d[1] = mulawtolin16[s[0]][1];			\
-			while (j < hw)					\
+			while (j > 0 && j < hw)				\
 				d[j++] = 0;				\
 		} FILTER_LOOP_EPILOGUE(this->src, dst);			\
 		break;							\
@@ -342,7 +342,7 @@ DEFINE_FILTER(mulaw_to_linear##n_prec)		
 			j = hw - 2;					\
 			d[0] = mulawtolin16[s[0]][0] ^ 0x80;		\
 			d[1] = mulawtolin16[s[0]][1];			\
-			while (j < hw)					\
+			while (j > 0 && j < hw)				\
 				d[j++] = 0;				\
 		} FILTER_LOOP_EPILOGUE(this->src, dst);			\
 		break;							\
@@ -459,7 +459,7 @@ DEFINE_FILTER(alaw_to_linear##n_prec)			
 			j = hw - 2;					\
 			d[0] = alawtolin16[s[0]][0];			\
 			d[1] = alawtolin16[s[0]][1];			\
-			while (j < hw)					\
+			while (j > 0 && j < hw)				\
 				d[j++] = 0;				\
 		} FILTER_LOOP_EPILOGUE(this->src, dst);			\
 		break;							\
@@ -477,7 +477,7 @@ DEFINE_FILTER(alaw_to_linear##n_prec)			
 			j = hw - 2;					\
 			d[0] = alawtolin16[s[0]][0] ^ 0x80;		\
 			d[1] = alawtolin16[s[0]][1];			\
-			while (j < hw)	 				\
+			while (j > 0 && j < hw)				\
 				d[j++] = 0;				\
 		} FILTER_LOOP_EPILOGUE(this->src, dst);			\
 		break;							\

Reply via email to