ALib C++ Library
Library Version: 2511 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
dbgdoublelengthcheck.cpp
1//##################################################################################################
2// ALib C++ Library
3//
4// Copyright 2013-2025 A-Worx GmbH, Germany
5// Published under 'Boost Software License' (a free software license, see LICENSE.txt)
6//##################################################################################################
7#include "alib_precompile.hpp"
8#if !defined(ALIB_C20_MODULES) || ((ALIB_C20_MODULES != 0) && (ALIB_C20_MODULES != 1))
9# error "Symbol ALIB_C20_MODULES has to be given to the compiler as either 0 or 1"
10#endif
11#if ALIB_C20_MODULES
12 module;
13#endif
14//========================================= Global Fragment ========================================
16#include <cstring>
17
18#if ALIB_DEBUG && !DOXYGEN
19namespace alib::boxing::debug {
20
21 // This is used by boxing::Bootstrap to do runtime-check for compatibility of boxing
22 // and long double values.
23 // It was put here to prevent the compiler to optimize and remove the code.
24 extern long double LONGDOUBLE_WRITE_TEST_MEM[2];
25 long double LONGDOUBLE_WRITE_TEST_MEM[2];
26extern void LongDoubleTrueLengthSet();
27void LongDoubleTrueLengthSet()
28{ memset( LONGDOUBLE_WRITE_TEST_MEM, 0x3E, 2 * ALIB_SIZEOF_LONGDOUBLE_REPORTED); }
29extern bool LongDoubleTrueLengthTest();
30bool LongDoubleTrueLengthTest() {
31const char* mem= reinterpret_cast<const char*>( LONGDOUBLE_WRITE_TEST_MEM );
32return mem[ALIB_SIZEOF_LONGDOUBLE_WRITTEN - 1] != 0x3E
33 && mem[ALIB_SIZEOF_LONGDOUBLE_WRITTEN ] == 0x3E;
34}
35} // namespace [alib::boxing::detail]
36#endif
37
38//============================================== Module ============================================
39#if ALIB_C20_MODULES
40 module ALib.Boxing;
41#endif
42//========================================== Implementation ========================================
#define ALIB_SIZEOF_LONGDOUBLE_REPORTED
Definition prepro.dox.md:26
#define ALIB_SIZEOF_LONGDOUBLE_WRITTEN
Definition prepro.dox.md:27