From ffa313e80a27005405334db6491075442f6e1abd Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Thu, 20 Dec 2018 08:35:51 +0100 Subject: Mac: o Using more natural byte ordering in the code. No external effect. o Using global ==, != and < operators instead of in-class operators for better compatibility with STL. ByteBuffer: o Renaming setPosition() to setCursor(). --- include/ble/ByteBuffer.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'include/ble/ByteBuffer.h') diff --git a/include/ble/ByteBuffer.h b/include/ble/ByteBuffer.h index 6b09049..1ba088f 100644 --- a/include/ble/ByteBuffer.h +++ b/include/ble/ByteBuffer.h @@ -42,7 +42,7 @@ public: ByteBuffer(uint8_t *bytes, size_t size) noexcept : zero(bytes), end_(&bytes[size]), cursor(zero) {}; ByteBuffer(uint8_t *bytes, size_t size, size_t position) : zero(bytes), end_(&bytes[size]), cursor(zero) { - setPosition(position); + setCursor(position); }; template @@ -64,8 +64,10 @@ public: return end_ - cursor; } - inline ByteBuffer &setPosition(size_t newCursor) { - cursor = &zero[newCursor]; + inline ByteBuffer &setCursor(size_t newCursor) { + auto tmp = &zero[newCursor]; + assertCanAccessPtr(tmp); + cursor = tmp; return *this; } -- cgit v1.2.3