ALib C++ Library
Library Version: 2510 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];
26 extern void LongDoubleTrueLengthSet();
27 void LongDoubleTrueLengthSet()
28 {
29 memset( LONGDOUBLE_WRITE_TEST_MEM, 0x3E, 2 * ALIB_SIZEOF_LONGDOUBLE_REPORTED);
30 }
31 extern bool LongDoubleTrueLengthTest();
32 bool LongDoubleTrueLengthTest()
33 {
34 const char* mem= reinterpret_cast<const char*>( LONGDOUBLE_WRITE_TEST_MEM );
35 return mem[ALIB_SIZEOF_LONGDOUBLE_WRITTEN - 1] != 0x3E
36 && mem[ALIB_SIZEOF_LONGDOUBLE_WRITTEN ] == 0x3E;
37 }
38} // namespace [alib::boxing::detail]
39#endif
40
41// =========================================== Module ==========================================
42#if ALIB_C20_MODULES
43 module ALib.Boxing;
44#endif
45// ====================================== Implementation =======================================
46
47
48
#define ALIB_SIZEOF_LONGDOUBLE_REPORTED
Definition prepro.md:26
#define ALIB_SIZEOF_LONGDOUBLE_WRITTEN
Definition prepro.md:27