projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added tests, and corrected behaviour of LogicDataSnapshot::pow2_ceil
[pulseview.git]
/
logicdatasnapshot.cpp
diff --git
a/logicdatasnapshot.cpp
b/logicdatasnapshot.cpp
index e751b9d1cd6ae3528311913b7a284fdafaa123b2..5301abf59d04d6920892a5b6bfaa143ebf04c9ad 100644
(file)
--- a/
logicdatasnapshot.cpp
+++ b/
logicdatasnapshot.cpp
@@
-323,7
+323,8
@@
void LogicDataSnapshot::get_subsampled_edges(
get_sample(end) & sig_mask));
}
get_sample(end) & sig_mask));
}
-int64_t LogicDataSnapshot::pow2_ceil(int64_t x, int power)
+int64_t LogicDataSnapshot::pow2_ceil(int64_t x,
unsigned
int power)
{
{
- return ((x >> power) + 1) << power;
+ const int64_t p = 1 << power;
+ return ((x < 0) ? x : (x + p - 1)) / p * p;
}
}