mirror of
https://github.com/isar/libmdbx.git
synced 2024-10-30 11:29:19 +08:00
mdbx++: исправление append_u8()
.
This commit is contained in:
parent
a79a318d61
commit
bcd955aeb9
14
mdbx.h++
14
mdbx.h++
@ -2895,7 +2895,7 @@ public:
|
|||||||
buffer &append(const void *src, size_t bytes) {
|
buffer &append(const void *src, size_t bytes) {
|
||||||
if (MDBX_UNLIKELY(tailroom() < check_length(bytes)))
|
if (MDBX_UNLIKELY(tailroom() < check_length(bytes)))
|
||||||
MDBX_CXX20_UNLIKELY reserve_tailroom(bytes);
|
MDBX_CXX20_UNLIKELY reserve_tailroom(bytes);
|
||||||
memcpy(slice_.byte_ptr() + size(), src, bytes);
|
memcpy(end_byte_ptr(), src, bytes);
|
||||||
slice_.iov_len += bytes;
|
slice_.iov_len += bytes;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@ -2964,7 +2964,7 @@ public:
|
|||||||
buffer &append_u8(uint_fast8_t u8) {
|
buffer &append_u8(uint_fast8_t u8) {
|
||||||
if (MDBX_UNLIKELY(tailroom() < 1))
|
if (MDBX_UNLIKELY(tailroom() < 1))
|
||||||
MDBX_CXX20_UNLIKELY reserve_tailroom(1);
|
MDBX_CXX20_UNLIKELY reserve_tailroom(1);
|
||||||
*slice_.byte_ptr() = u8;
|
*slice_.end_byte_ptr() = uint8_t(u8);
|
||||||
slice_.iov_len += 1;
|
slice_.iov_len += 1;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@ -2974,7 +2974,7 @@ public:
|
|||||||
buffer &append_u16(uint_fast16_t u16) {
|
buffer &append_u16(uint_fast16_t u16) {
|
||||||
if (MDBX_UNLIKELY(tailroom() < 2))
|
if (MDBX_UNLIKELY(tailroom() < 2))
|
||||||
MDBX_CXX20_UNLIKELY reserve_tailroom(2);
|
MDBX_CXX20_UNLIKELY reserve_tailroom(2);
|
||||||
const auto ptr = slice_.byte_ptr();
|
const auto ptr = slice_.end_byte_ptr();
|
||||||
ptr[0] = uint8_t(u16);
|
ptr[0] = uint8_t(u16);
|
||||||
ptr[1] = uint8_t(u16 >> 8);
|
ptr[1] = uint8_t(u16 >> 8);
|
||||||
slice_.iov_len += 2;
|
slice_.iov_len += 2;
|
||||||
@ -2984,7 +2984,7 @@ public:
|
|||||||
buffer &append_u24(uint_fast32_t u24) {
|
buffer &append_u24(uint_fast32_t u24) {
|
||||||
if (MDBX_UNLIKELY(tailroom() < 3))
|
if (MDBX_UNLIKELY(tailroom() < 3))
|
||||||
MDBX_CXX20_UNLIKELY reserve_tailroom(3);
|
MDBX_CXX20_UNLIKELY reserve_tailroom(3);
|
||||||
const auto ptr = slice_.byte_ptr();
|
const auto ptr = slice_.end_byte_ptr();
|
||||||
ptr[0] = uint8_t(u24);
|
ptr[0] = uint8_t(u24);
|
||||||
ptr[1] = uint8_t(u24 >> 8);
|
ptr[1] = uint8_t(u24 >> 8);
|
||||||
ptr[2] = uint8_t(u24 >> 16);
|
ptr[2] = uint8_t(u24 >> 16);
|
||||||
@ -2995,7 +2995,7 @@ public:
|
|||||||
buffer &append_u32(uint_fast32_t u32) {
|
buffer &append_u32(uint_fast32_t u32) {
|
||||||
if (MDBX_UNLIKELY(tailroom() < 4))
|
if (MDBX_UNLIKELY(tailroom() < 4))
|
||||||
MDBX_CXX20_UNLIKELY reserve_tailroom(4);
|
MDBX_CXX20_UNLIKELY reserve_tailroom(4);
|
||||||
const auto ptr = slice_.byte_ptr();
|
const auto ptr = slice_.end_byte_ptr();
|
||||||
ptr[0] = uint8_t(u32);
|
ptr[0] = uint8_t(u32);
|
||||||
ptr[1] = uint8_t(u32 >> 8);
|
ptr[1] = uint8_t(u32 >> 8);
|
||||||
ptr[2] = uint8_t(u32 >> 16);
|
ptr[2] = uint8_t(u32 >> 16);
|
||||||
@ -3007,7 +3007,7 @@ public:
|
|||||||
buffer &append_u48(uint_fast64_t u48) {
|
buffer &append_u48(uint_fast64_t u48) {
|
||||||
if (MDBX_UNLIKELY(tailroom() < 6))
|
if (MDBX_UNLIKELY(tailroom() < 6))
|
||||||
MDBX_CXX20_UNLIKELY reserve_tailroom(6);
|
MDBX_CXX20_UNLIKELY reserve_tailroom(6);
|
||||||
const auto ptr = slice_.byte_ptr();
|
const auto ptr = slice_.end_byte_ptr();
|
||||||
ptr[0] = uint8_t(u48);
|
ptr[0] = uint8_t(u48);
|
||||||
ptr[1] = uint8_t(u48 >> 8);
|
ptr[1] = uint8_t(u48 >> 8);
|
||||||
ptr[2] = uint8_t(u48 >> 16);
|
ptr[2] = uint8_t(u48 >> 16);
|
||||||
@ -3021,7 +3021,7 @@ public:
|
|||||||
buffer &append_u64(uint_fast64_t u64) {
|
buffer &append_u64(uint_fast64_t u64) {
|
||||||
if (MDBX_UNLIKELY(tailroom() < 8))
|
if (MDBX_UNLIKELY(tailroom() < 8))
|
||||||
MDBX_CXX20_UNLIKELY reserve_tailroom(8);
|
MDBX_CXX20_UNLIKELY reserve_tailroom(8);
|
||||||
const auto ptr = slice_.byte_ptr();
|
const auto ptr = slice_.end_byte_ptr();
|
||||||
ptr[0] = uint8_t(u64);
|
ptr[0] = uint8_t(u64);
|
||||||
ptr[1] = uint8_t(u64 >> 8);
|
ptr[1] = uint8_t(u64 >> 8);
|
||||||
ptr[2] = uint8_t(u64 >> 16);
|
ptr[2] = uint8_t(u64 >> 16);
|
||||||
|
Loading…
Reference in New Issue
Block a user