1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00

MCOL-641 Clean up primitives code

Add int128_t support into ByteStream

Fixed UTs broken after collation patch
This commit is contained in:
Roman Nozdrin
2020-07-17 14:56:59 +00:00
parent 638202417f
commit 1588ebe439
23 changed files with 225 additions and 197 deletions

View File

@ -235,18 +235,6 @@ ByteStream& ByteStream::operator<<(const uint64_t o)
return *this;
}
// WIP MCOL-641
ByteStream& ByteStream::operator<<(const int128_t& o)
{
if (fBuf == 0 || (fCurInPtr - fBuf + 16U > fMaxLen + ISSOverhead))
growBuf(fMaxLen + BlockSize);
*((int128_t*) fCurInPtr) = o;
fCurInPtr += 16;
return *this;
}
ByteStream& ByteStream::operator<<(const uint128_t& o)
{
if (fBuf == 0 || (fCurInPtr - fBuf + 16U > fMaxLen + ISSOverhead))
@ -258,6 +246,17 @@ ByteStream& ByteStream::operator<<(const uint128_t& o)
return *this;
}
ByteStream& ByteStream::operator<<(const int128_t& o)
{
if (fBuf == 0 || (fCurInPtr - fBuf + 16U > fMaxLen + ISSOverhead))
growBuf(fMaxLen + BlockSize);
*((int128_t*) fCurInPtr) = o;
fCurInPtr += 16;
return *this;
}
ByteStream& ByteStream::operator<<(const string& s)
{
int32_t len = s.size();
@ -342,15 +341,14 @@ ByteStream& ByteStream::operator>>(uint64_t& o)
return *this;
}
// WIP MCOL-641
ByteStream& ByteStream::operator>>(int128_t& o)
ByteStream& ByteStream::operator>>(uint128_t& o)
{
peek(o);
fCurOutPtr += 16;
return *this;
}
ByteStream& ByteStream::operator>>(uint128_t& o)
ByteStream& ByteStream::operator>>(int128_t& o)
{
peek(o);
fCurOutPtr += 16;
@ -437,16 +435,6 @@ void ByteStream::peek(uint64_t& o) const
o = *((uint64_t*) fCurOutPtr);
}
// WIP MCOL-641
void ByteStream::peek(int128_t& o) const
{
if (length() < 16)
throw underflow_error("ByteStream>int128_t: not enough data in stream to fill datatype");
o = *((int128_t*) fCurOutPtr);
}
void ByteStream::peek(uint128_t& o) const
{
@ -456,6 +444,15 @@ void ByteStream::peek(uint128_t& o) const
o = *((uint128_t*) fCurOutPtr);
}
void ByteStream::peek(int128_t& o) const
{
if (length() < 16)
throw underflow_error("ByteStream>int128_t: not enough data in stream to fill datatype");
o = *((int128_t*) fCurOutPtr);
}
void ByteStream::peek(string& s) const
{
int32_t len;