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

MCOL-1822 add LONG DOUBLE support

This commit is contained in:
David Hall
2019-01-29 09:55:43 -06:00
parent ee2cb7b0de
commit c5b9ae11e5
40 changed files with 746 additions and 38 deletions

View File

@ -636,6 +636,18 @@ ByteStream& ByteStream::operator<<(const double d)
return *this;
}
ByteStream& ByteStream::operator<<(const long double d)
{
int sz = sizeof(long double);
if (fBuf == 0 || (fCurInPtr - fBuf + sz > fMaxLen + ISSOverhead))
growBuf(fMaxLen + BlockSize);
*((long double*) fCurInPtr) = d;
fCurInPtr += sz;
return *this;
}
ByteStream& ByteStream::operator>>(float& f)
{
peek(f);
@ -648,6 +660,12 @@ ByteStream& ByteStream::operator>>(double& d)
fCurOutPtr += sizeof(double);
return *this;
}
ByteStream& ByteStream::operator>>(long double& d)
{
peek(d);
fCurOutPtr += sizeof(long double);
return *this;
}
void ByteStream::peek(float& f) const
{
if (length() < sizeof(float))
@ -663,6 +681,14 @@ void ByteStream::peek(double& d) const
d = *((double*) fCurOutPtr);
}
void ByteStream::peek(long double& d) const
{
if (length() < sizeof(long double))
throw underflow_error("ByteStream>int64_t: not enough data in stream to fill datatype");
d = *((long double*) fCurOutPtr);
}
}//namespace messageqcpp