Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 200e7758504e
Choose a base ref
...
head repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: b38d48da3eb6
Choose a head ref
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Dec 7, 2020

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    b38d48d View commit details
Showing with 10 additions and 2 deletions.
  1. +10 −2 scopehal/scopehal.cpp
12 changes: 10 additions & 2 deletions scopehal/scopehal.cpp
Original file line number Diff line number Diff line change
@@ -411,16 +411,24 @@ string to_string_sci(double d)
}

/**
@brief compute the next highest power of 2 of 64-bit value
@brief Rounds a 64-bit integer up to the next power of 2
*/
uint64_t next_pow2(uint64_t v)
uint64_t next_pow2(uint64_t v)
{
#ifdef __GNUC__
if(v == 1)
return 1;
else
return 1 << (64 - __builtin_clzl(v-1));
#else
v--;
v |= v >> 1;
v |= v >> 2;
v |= v >> 4;
v |= v >> 8;
v |= v >> 16;
v |= v >> 32;
v++;
return v;
#endif
}