Add misaligned pointer debug.

GitOrigin-RevId: 83e3727e541c490029c6ebf19188a8b866779088
This commit is contained in:
levlam 2019-05-03 16:53:34 +03:00
parent 3c6f21d5a3
commit d92af070c4
2 changed files with 5 additions and 2 deletions

View File

@ -13,6 +13,7 @@
#include "td/utils/common.h"
#include "td/utils/format.h"
#include "td/utils/logging.h"
#include "td/utils/misc.h"
#include "td/utils/Slice.h"
#include "td/utils/Status.h"
#include "td/utils/StorerBase.h"
@ -276,8 +277,10 @@ BufferSlice log_event_store(const T &data) {
store(data, storer_calc_length);
BufferSlice value_buffer{storer_calc_length.get_length()};
auto ptr = value_buffer.as_slice().ubegin();
LOG_CHECK(is_aligned_pointer<4>(ptr)) << ptr;
LogEventStorerUnsafe storer_unsafe(value_buffer.as_slice().ubegin());
LogEventStorerUnsafe storer_unsafe(ptr);
store(data, storer_unsafe);
#ifdef TD_DEBUG

View File

@ -22,7 +22,7 @@ class TlStorerUnsafe {
public:
explicit TlStorerUnsafe(unsigned char *buf) : buf_(buf) {
CHECK(is_aligned_pointer<4>(buf_));
LOG_CHECK(is_aligned_pointer<4>(buf_)) << buf_;
}
TlStorerUnsafe(const TlStorerUnsafe &other) = delete;