Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/audio/play Spell the largest 32bit signed value as I...



details:   https://anonhg.NetBSD.org/src/rev/c70ea8c8afdc
branches:  trunk
changeset: 966686:c70ea8c8afdc
user:      joerg <joerg%NetBSD.org@localhost>
date:      Mon Nov 11 15:40:42 2019 +0000

description:
Spell the largest 32bit signed value as INT32_MAX. Explicitly cast to
float, because it is not precisely representable.

diffstat:

 usr.bin/audio/play/play.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 1c9570918878 -r c70ea8c8afdc usr.bin/audio/play/play.c
--- a/usr.bin/audio/play/play.c Mon Nov 11 13:42:49 2019 +0000
+++ b/usr.bin/audio/play/play.c Mon Nov 11 15:40:42 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: play.c,v 1.59 2019/11/09 12:54:34 mrg Exp $    */
+/*     $NetBSD: play.c,v 1.60 2019/11/11 15:40:42 joerg Exp $  */
 
 /*
  * Copyright (c) 1999, 2000, 2001, 2002, 2010, 2015, 2019 Matthew R. Green
@@ -28,7 +28,7 @@
 #include <sys/cdefs.h>
 
 #ifndef lint
-__RCSID("$NetBSD: play.c,v 1.59 2019/11/09 12:54:34 mrg Exp $");
+__RCSID("$NetBSD: play.c,v 1.60 2019/11/11 15:40:42 joerg Exp $");
 #endif
 
 #include <sys/param.h>
@@ -236,7 +236,7 @@
                        f = 1.0;
 
                /* Convert -1.0 to +1.0 into a 32 bit signed value */
-               i = f * ((1u << 31) - 1);
+               i = f * (float)INT32_MAX;
 
                memcpy(outbuf8, &i, sizeof i);
 



Home | Main Index | Thread Index | Old Index