27 lines
624 B
C++
27 lines
624 B
C++
#ifndef C536E080_25D7_476D_B8E3_25912B9CFC3B
|
|
#define C536E080_25D7_476D_B8E3_25912B9CFC3B
|
|
|
|
#include <cassert>
|
|
#include <cstdint>
|
|
#include <limits>
|
|
|
|
namespace mesytec::mnode
|
|
{
|
|
// round n up to the nearest multiple of p
|
|
// source: https://blog.xoria.org/rounding-up/
|
|
inline int64_t round_up(int64_t n, int64_t p)
|
|
{
|
|
int64_t mask = p - 1;
|
|
return (n + mask) & ~mask;
|
|
}
|
|
|
|
inline double make_quiet_nan()
|
|
{
|
|
double result = std::numeric_limits<double>::quiet_NaN();
|
|
assert(((uintptr_t)(result) & 0xffffffff) == 0);
|
|
return result;
|
|
}
|
|
|
|
} // namespace mesytec::mnode
|
|
|
|
#endif /* C536E080_25D7_476D_B8E3_25912B9CFC3B */
|