ALib C++ Framework
by
Library Version: 2605 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
dbgdoublelengthcheck.cpp
1#if ALIB_DEBUG && !DOXYGEN
2namespace alib::boxing::debug {
3
4 // This is used by boxing::Bootstrap to do runtime-check for compatibility of boxing
5 // and long double values.
6 // It was put here to prevent the compiler to optimize and remove the code.
7 extern long double LONGDOUBLE_WRITE_TEST_MEM[2];
8 long double LONGDOUBLE_WRITE_TEST_MEM[2];
9extern void LongDoubleTrueLengthSet();
10void LongDoubleTrueLengthSet()
11{ memset( LONGDOUBLE_WRITE_TEST_MEM, 0x3E, 2 * ALIB_SIZEOF_LONGDOUBLE_REPORTED); }
12extern bool LongDoubleTrueLengthTest();
13bool LongDoubleTrueLengthTest() {
14const char* mem= reinterpret_cast<const char*>( LONGDOUBLE_WRITE_TEST_MEM );
15return mem[ALIB_SIZEOF_LONGDOUBLE_WRITTEN - 1] != 0x3E
16 && mem[ALIB_SIZEOF_LONGDOUBLE_WRITTEN ] == 0x3E;
17}
18} // namespace [alib::boxing::detail]
19#endif
#define ALIB_SIZEOF_LONGDOUBLE_REPORTED
#define ALIB_SIZEOF_LONGDOUBLE_WRITTEN