summaryrefslogtreecommitdiff
path: root/audio/libaudiofile/patches/patch-libaudiofile_modules_SimpleModule.h
blob: d8dfd2c320226d48d48229b2a81344c16ec57a30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
$NetBSD: patch-libaudiofile_modules_SimpleModule.h,v 1.1 2016/12/17 16:40:31 maya Exp $

Left shift of a negative number is UB and doesn't build (-fpermissive)
Switch with functionally identical but well-defined operation.

--- libaudiofile/modules/SimpleModule.h.orig	2013-03-06 05:30:03.000000000 +0000
+++ libaudiofile/modules/SimpleModule.h
@@ -123,7 +123,7 @@ struct signConverter
 	typedef typename IntTypes<Format>::UnsignedType UnsignedType;
 
 	static const int kScaleBits = (Format + 1) * CHAR_BIT - 1;
-	static const int kMinSignedValue = -1 << kScaleBits;
+	static const int kMinSignedValue = ~((1 << kScaleBits) - 1);
 
 	struct signedToUnsigned : public std::unary_function<SignedType, UnsignedType>
 	{