pulseview/0005-Fix-clang-warning-shif...

36 lines
1.1 KiB
Diff

From c28fa62bc89656ba3b1b01011a45e941d6c7d42a Mon Sep 17 00:00:00 2001
From: Soeren Apel <soeren@apelpie.net>
Date: Sun, 31 Jan 2016 18:22:17 +0100
Subject: [PATCH 05/13] Fix clang warning: shifting a negative signed value is
undefined
---
pv/data/logicsegment.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pv/data/logicsegment.cpp b/pv/data/logicsegment.cpp
index 3e18b85..a5634b3 100644
--- a/pv/data/logicsegment.cpp
+++ b/pv/data/logicsegment.cpp
@@ -308,7 +308,7 @@ void LogicSegment::get_subsampled_edges(
pow2_ceil(index, MipMapScalePower));
for (; index < final_index &&
- (index & ~(~0 << MipMapScalePower)) != 0;
+ (index & ~((uint64_t)(~0) << MipMapScalePower)) != 0;
index++) {
const bool sample =
(get_sample(index) & sig_mask) != 0;
@@ -358,7 +358,7 @@ void LogicSegment::get_subsampled_edges(
sig_mask))
break;
- if ((offset & ~(~0 << MipMapScalePower)) == 0) {
+ if ((offset & ~((uint64_t)(~0) << MipMapScalePower)) == 0) {
// If we are now at the beginning of a
// higher level mip-map block ascend one
// level
--
2.4.3