Skip to content

Commit

Permalink
merge mozilla-central to mozilla-inbound. r=merge a=merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Archaeopteryx committed Nov 5, 2017
2 parents 5de998d + 5a60492 commit c888605
Show file tree
Hide file tree
Showing 5 changed files with 542 additions and 536 deletions.
23 changes: 23 additions & 0 deletions memory/build/Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,27 @@ struct Log2 : mozilla::tl::CeilingLog2<N>
};
#define LOG2(N) Log2<N>::value

// Compare two addresses. Returns whether the first address is smaller (-1),
// equal (0) or greater (1) than the second address.
template<typename T>
int
CompareAddr(T* aAddr1, T* aAddr2)
{
uintptr_t addr1 = reinterpret_cast<uintptr_t>(aAddr1);
uintptr_t addr2 = reinterpret_cast<uintptr_t>(aAddr2);

return (addr1 > addr2) - (addr1 < addr2);
}

// User-defined literals to make constants more legible
constexpr unsigned long long int operator"" _KiB(unsigned long long int aNum)
{
return aNum * 1024;
}

constexpr unsigned long long int operator"" _MiB(unsigned long long int aNum)
{
return aNum * 1024_KiB;
}

#endif
Loading

0 comments on commit c888605

Please sign in to comment.