add msg argument for vint::dump

dev
MITSUNARI Shigeo 7 years ago
parent d0a6157074
commit 57e8185b29
  1. 8
      include/mcl/vint.hpp

@ -37,9 +37,10 @@ typedef uint32_t Unit;
#endif
template<class T>
void dump(const T *x, size_t n)
void dump(const T *x, size_t n, const char *msg = "")
{
const size_t is4byteUnit = sizeof(*x) == 4;
if (msg) printf("%s ", msg);
for (size_t i = 0; i < n; i++) {
if (is4byteUnit) {
printf("%08x", (uint32_t)x[n - 1 - i]);
@ -1189,10 +1190,9 @@ public:
std::swap(size_, rhs.size_);
std::swap(isNeg_, rhs.isNeg_);
}
void dump() const
void dump(const char *msg = "") const
{
printf("size_=%d ", (int)size_);
vint::dump(buf_, size_);
vint::dump(&buf_[0], size_, msg);
}
/*
set positive value

Loading…
Cancel
Save