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

View File

@ -153,6 +153,11 @@ public:
* whatever the native byte order is.
*/
EXPORT ByteStream& operator<<(const double d);
/**
* push a long double onto the end of the stream. The byte
* order is whatever the native byte order is.
*/
EXPORT ByteStream& operator<<(const long double d);
/**
* push a std::string onto the end of the stream.
*/
@ -212,6 +217,11 @@ public:
* order is whatever the native byte order is.
*/
EXPORT ByteStream& operator>>(double& d);
/**
* extract a long double from the front of the stream. The byte
* order is whatever the native byte order is.
*/
EXPORT ByteStream& operator>>(long double& d);
/**
* extract a std::string from the front of the stream.
*/
@ -277,6 +287,11 @@ public:
* order is whatever the native byte order is.
*/
EXPORT void peek(double& f) const;
/**
* Peek at a long double from the front of the stream. The byte
* order is whatever the native byte order is.
*/
EXPORT void peek(long double& f) const;
/**
* Peek at a std::string from the front of the stream.
*/