mirror of
https://github.com/boostorg/endian.git
synced 2025-08-02 05:54:31 +02:00
Add data() member
git-svn-id: http://svn.boost.org/svn/boost/sandbox/endian@62439 b8fc166d-592f-0410-95f2-cb63ce0dd405
This commit is contained in:
@@ -198,6 +198,7 @@ namespace boost
|
|||||||
# endif
|
# endif
|
||||||
return detail::load_big_endian<T, n_bits/8>(m_value);
|
return detail::load_big_endian<T, n_bits/8>(m_value);
|
||||||
}
|
}
|
||||||
|
const char* data() const { return m_value; }
|
||||||
private:
|
private:
|
||||||
char m_value[n_bits/8];
|
char m_value[n_bits/8];
|
||||||
};
|
};
|
||||||
@@ -230,6 +231,7 @@ namespace boost
|
|||||||
# endif
|
# endif
|
||||||
return detail::load_little_endian<T, n_bits/8>(m_value);
|
return detail::load_little_endian<T, n_bits/8>(m_value);
|
||||||
}
|
}
|
||||||
|
const char* data() const { return m_value; }
|
||||||
private:
|
private:
|
||||||
char m_value[n_bits/8];
|
char m_value[n_bits/8];
|
||||||
};
|
};
|
||||||
@@ -257,6 +259,7 @@ namespace boost
|
|||||||
endian & operator=(T val) { detail::store_little_endian<T, n_bits/8>(m_value, val); return *this; }
|
endian & operator=(T val) { detail::store_little_endian<T, n_bits/8>(m_value, val); return *this; }
|
||||||
operator T() const { return detail::load_little_endian<T, n_bits/8>(m_value); }
|
operator T() const { return detail::load_little_endian<T, n_bits/8>(m_value); }
|
||||||
# endif
|
# endif
|
||||||
|
const char* data() const { return m_value; }
|
||||||
private:
|
private:
|
||||||
char m_value[n_bits/8];
|
char m_value[n_bits/8];
|
||||||
};
|
};
|
||||||
@@ -288,6 +291,7 @@ namespace boost
|
|||||||
endian & operator=(T val) { detail::store_big_endian<T, sizeof(T)>(&m_value, val); return *this; }
|
endian & operator=(T val) { detail::store_big_endian<T, sizeof(T)>(&m_value, val); return *this; }
|
||||||
operator T() const { return detail::load_big_endian<T, sizeof(T)>(&m_value); }
|
operator T() const { return detail::load_big_endian<T, sizeof(T)>(&m_value); }
|
||||||
# endif
|
# endif
|
||||||
|
const char* data() const { return reinterpret_cast<const char *>(&m_value); }
|
||||||
private:
|
private:
|
||||||
T m_value;
|
T m_value;
|
||||||
};
|
};
|
||||||
@@ -316,6 +320,7 @@ namespace boost
|
|||||||
endian & operator=(T val) { detail::store_little_endian<T, sizeof(T)>(&m_value, val); return *this; }
|
endian & operator=(T val) { detail::store_little_endian<T, sizeof(T)>(&m_value, val); return *this; }
|
||||||
operator T() const { return detail::load_little_endian<T, sizeof(T)>(&m_value); }
|
operator T() const { return detail::load_little_endian<T, sizeof(T)>(&m_value); }
|
||||||
#endif
|
#endif
|
||||||
|
const char* data() const { return reinterpret_cast<const char *>(&m_value); }
|
||||||
private:
|
private:
|
||||||
T m_value;
|
T m_value;
|
||||||
};
|
};
|
||||||
|
@@ -119,7 +119,7 @@ namespace boost
|
|||||||
inline typename boost::enable_if< is_endian<Endian>, std::ostream & >::type
|
inline typename boost::enable_if< is_endian<Endian>, std::ostream & >::type
|
||||||
operator<=( std::ostream & os, const Endian & e )
|
operator<=( std::ostream & os, const Endian & e )
|
||||||
{
|
{
|
||||||
return os.write( reinterpret_cast<const char*>(&e), sizeof(e) );
|
return os.write( e.data(), sizeof(e) );
|
||||||
}
|
}
|
||||||
|
|
||||||
template < class Endian >
|
template < class Endian >
|
||||||
|
@@ -12,12 +12,12 @@
|
|||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
|
||||||
<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
|
<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="710">
|
||||||
<tr>
|
<tr>
|
||||||
<td width="277">
|
<td width="277">
|
||||||
<a href="../../../index.html">
|
<a href="../../../index.html">
|
||||||
<img src="../../../boost.png" alt="boost.png (6897 bytes)" align="middle" width="277" height="86" border="0"></a></td>
|
<img src="../../../boost.png" alt="boost.png (6897 bytes)" align="middle" width="277" height="86" border="0"></a></td>
|
||||||
<td width="337" align="middle">
|
<td width="413" align="middle">
|
||||||
<font size="7">Endian Integers</font>
|
<font size="7">Endian Integers</font>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -51,6 +51,7 @@
|
|||||||
<a href="#Example">Example</a><br>
|
<a href="#Example">Example</a><br>
|
||||||
<a href="#Design">Design</a><br>
|
<a href="#Design">Design</a><br>
|
||||||
<a href="#Experience">Experience</a><br>
|
<a href="#Experience">Experience</a><br>
|
||||||
|
<a href="#Motivating-use-cases">Motivating use cases</a><br>
|
||||||
<a href="#C++0x">C++0x</a><br>
|
<a href="#C++0x">C++0x</a><br>
|
||||||
<a href="#Compilation">Compilation</a><br>
|
<a href="#Compilation">Compilation</a><br>
|
||||||
<a href="#Acknowledgements">Acknowledgements</a>
|
<a href="#Acknowledgements">Acknowledgements</a>
|
||||||
@@ -290,10 +291,15 @@ usual operations on integers are supplied.</p>
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef T value_type;
|
typedef T value_type;
|
||||||
|
|
||||||
|
// if BOOST_ENDIAN_FORCE_PODNESS is defined && C++0x POD's are not
|
||||||
|
// available then these two constructors will not be present
|
||||||
<a href="#endian">endian</a>() = default; // = default replaced by {} on C++03
|
<a href="#endian">endian</a>() = default; // = default replaced by {} on C++03
|
||||||
explicit <a href="#explicit-endian">endian</a>(T v);
|
explicit <a href="#explicit-endian">endian</a>(T v);
|
||||||
|
|
||||||
endian & <a href="#operator-eq">operator=</a>(T v);
|
endian & <a href="#operator-eq">operator=</a>(T v);
|
||||||
<a href="#operator-T">operator T</a>() const;
|
<a href="#operator-T">operator T</a>() const;
|
||||||
|
const char* <a href="#data">data</a>() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
// unaligned big endian signed integer types
|
// unaligned big endian signed integer types
|
||||||
@@ -406,6 +412,11 @@ constructed object.</p>
|
|||||||
<p><i>Returns:</i> The current value stored in <code>*this</code>, converted to
|
<p><i>Returns:</i> The current value stored in <code>*this</code>, converted to
|
||||||
<code>value_type</code>.</p>
|
<code>value_type</code>.</p>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
|
<p><code>const char* <a name="data">data</a>() const;</code></p>
|
||||||
|
<blockquote>
|
||||||
|
<p><i>Returns:</i> A pointer to the first byte of the endian binary value stored
|
||||||
|
in <code>*this</code>.</p>
|
||||||
|
</blockquote>
|
||||||
<h3>Other operators</h3>
|
<h3>Other operators</h3>
|
||||||
<p>Other operators on endian objects are forwarded to the equivalent
|
<p>Other operators on endian objects are forwarded to the equivalent
|
||||||
operator on <code>value_type</code>.</p>
|
operator on <code>value_type</code>.</p>
|
||||||
@@ -436,10 +447,12 @@ are usually be faster, and sometimes much faster, for I/O compared to stream
|
|||||||
inserters and extractors, or to serialization.</p>
|
inserters and extractors, or to serialization.</p>
|
||||||
<p><b>Are endian types POD's?</b> Yes for C++0x. No for C++03, although several
|
<p><b>Are endian types POD's?</b> Yes for C++0x. No for C++03, although several
|
||||||
<a href="#Compilation">macros</a> are available to force PODness in all cases.</p>
|
<a href="#Compilation">macros</a> are available to force PODness in all cases.</p>
|
||||||
<p><b>What are the implications endian types not being POD's of C++03?</b> They
|
<p><b>What are the implications endian types not being POD's with C++03
|
||||||
can't be used in unions. In theory, compilers aren't required to align or lay
|
compilers?</b> They
|
||||||
out storage in portable ways, although this problem has never been observed in a
|
can't be used in unions. Also, compilers aren't required to align or lay
|
||||||
real compiler.</p>
|
out storage in portable ways, although this potential problem hasn't prevented
|
||||||
|
use of Boost.Endian with
|
||||||
|
real compilers.</p>
|
||||||
<p><b>Which is better, big-endian or little-endian?</b> Big-endian tends to be a
|
<p><b>Which is better, big-endian or little-endian?</b> Big-endian tends to be a
|
||||||
bit more of an industry standard, but little-endian may be preferred for
|
bit more of an industry standard, but little-endian may be preferred for
|
||||||
applications that run primarily on x86 (Intel/AMD) and other little-endian
|
applications that run primarily on x86 (Intel/AMD) and other little-endian
|
||||||
@@ -585,6 +598,11 @@ several Boost programmers and used very successful in high-value, high-use
|
|||||||
applications for many years. These independently developed endian libraries
|
applications for many years. These independently developed endian libraries
|
||||||
often evolved from C libraries that were also widely used. Endian integers have proven widely useful across a wide
|
often evolved from C libraries that were also widely used. Endian integers have proven widely useful across a wide
|
||||||
range of computer architectures and applications.</p>
|
range of computer architectures and applications.</p>
|
||||||
|
<h2><a name="Motivating-use-cases">Motivating use cases</a></h2>
|
||||||
|
<p>Neil Mayhew writes: "I can also provide a meaningful use-case for this
|
||||||
|
library: reading TrueType font files from disk and processing the contents. The
|
||||||
|
data format has fixed endianness (big) and has unaligned values in various
|
||||||
|
places. Using Boost.Endian simplifies and cleans the code wonderfully."</p>
|
||||||
<h2><a name="C++0x">C++0x</a></h2>
|
<h2><a name="C++0x">C++0x</a></h2>
|
||||||
<p>The availability of the C++0x
|
<p>The availability of the C++0x
|
||||||
<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2346.htm">
|
<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2346.htm">
|
||||||
@@ -622,20 +640,20 @@ Benaka Moorthi,
|
|||||||
Christopher Kohlhoff,
|
Christopher Kohlhoff,
|
||||||
Cliff Green,
|
Cliff Green,
|
||||||
Gennaro Proto,
|
Gennaro Proto,
|
||||||
Jeff Flinn,
|
Giovanni Piero Deretta, dizzy, Jeff Flinn,
|
||||||
John Maddock,
|
John Maddock,
|
||||||
Kim Barrett,
|
Kim Barrett,
|
||||||
Marsh Ray,
|
Marsh Ray,
|
||||||
Martin Bonner,
|
Martin Bonner,
|
||||||
Matias Capeletto,
|
Matias Capeletto,
|
||||||
Rene Rivera,
|
Neil Mayhew, Phil Endecott, Rene Rivera,
|
||||||
Scott McMurray,
|
Roland Schwarz, Scott McMurray,
|
||||||
Sebastian Redl,
|
Sebastian Redl,
|
||||||
Tomas Puverle, and
|
Tomas Puverle, Vincente Botet, and
|
||||||
Yuval Ronen.</p>
|
Yuval Ronen.</p>
|
||||||
<hr>
|
<hr>
|
||||||
<p>Last revised:
|
<p>Last revised:
|
||||||
<!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B, %Y" startspan -->19 March, 2009<!--webbot bot="Timestamp" endspan i-checksum="29039" --></p>
|
<!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %B, %Y" startspan -->25 March, 2009<!--webbot bot="Timestamp" endspan i-checksum="29032" --></p>
|
||||||
<p><EFBFBD> Copyright Beman Dawes, 2006-2009</p>
|
<p><EFBFBD> Copyright Beman Dawes, 2006-2009</p>
|
||||||
<p>Distributed under the Boost Software License, Version 1.0. (See accompanying
|
<p>Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||||
file <a href="../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or copy at
|
file <a href="../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or copy at
|
||||||
|
@@ -264,6 +264,8 @@ void op_test()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// main ------------------------------------------------------------------------------//
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
bi::endian_log = false;
|
bi::endian_log = false;
|
||||||
@@ -340,6 +342,20 @@ int main()
|
|||||||
|
|
||||||
bi::endian_log = false;
|
bi::endian_log = false;
|
||||||
|
|
||||||
|
// test from Roland Schwarz that detected ambiguities
|
||||||
|
unsigned u;
|
||||||
|
bi::ulittle32_t u1;
|
||||||
|
bi::ulittle32_t u2;
|
||||||
|
|
||||||
|
u = 1;
|
||||||
|
u1 = 1;
|
||||||
|
u2 = u1 + u;
|
||||||
|
|
||||||
|
// one more wrinkle
|
||||||
|
bi::ulittle16_t u3(3);
|
||||||
|
u3 = 3;
|
||||||
|
u2 = u1 + u3;
|
||||||
|
|
||||||
// perform the indicated test on ~60*60 operand types
|
// perform the indicated test on ~60*60 operand types
|
||||||
|
|
||||||
op_test<default_construct>();
|
op_test<default_construct>();
|
||||||
|
@@ -142,6 +142,152 @@ namespace
|
|||||||
cout << "That should not matter and is presented for your information only.\n";
|
cout << "That should not matter and is presented for your information only.\n";
|
||||||
} // detect_endianness
|
} // detect_endianness
|
||||||
|
|
||||||
|
// check_data ------------------------------------------------------------//
|
||||||
|
|
||||||
|
void check_data()
|
||||||
|
{
|
||||||
|
big8_t big8;
|
||||||
|
big16_t big16;
|
||||||
|
big24_t big24;
|
||||||
|
big32_t big32;
|
||||||
|
big40_t big40;
|
||||||
|
big48_t big48;
|
||||||
|
big56_t big56;
|
||||||
|
big64_t big64;
|
||||||
|
|
||||||
|
ubig8_t ubig8;
|
||||||
|
ubig16_t ubig16;
|
||||||
|
ubig24_t ubig24;
|
||||||
|
ubig32_t ubig32;
|
||||||
|
ubig40_t ubig40;
|
||||||
|
ubig48_t ubig48;
|
||||||
|
ubig56_t ubig56;
|
||||||
|
ubig64_t ubig64;
|
||||||
|
|
||||||
|
little8_t little8;
|
||||||
|
little16_t little16;
|
||||||
|
little24_t little24;
|
||||||
|
little32_t little32;
|
||||||
|
little40_t little40;
|
||||||
|
little48_t little48;
|
||||||
|
little56_t little56;
|
||||||
|
little64_t little64;
|
||||||
|
|
||||||
|
ulittle8_t ulittle8;
|
||||||
|
ulittle16_t ulittle16;
|
||||||
|
ulittle24_t ulittle24;
|
||||||
|
ulittle32_t ulittle32;
|
||||||
|
ulittle40_t ulittle40;
|
||||||
|
ulittle48_t ulittle48;
|
||||||
|
ulittle56_t ulittle56;
|
||||||
|
ulittle64_t ulittle64;
|
||||||
|
|
||||||
|
native8_t native8;
|
||||||
|
native16_t native16;
|
||||||
|
native24_t native24;
|
||||||
|
native32_t native32;
|
||||||
|
native40_t native40;
|
||||||
|
native48_t native48;
|
||||||
|
native56_t native56;
|
||||||
|
native64_t native64;
|
||||||
|
|
||||||
|
unative8_t unative8;
|
||||||
|
unative16_t unative16;
|
||||||
|
unative24_t unative24;
|
||||||
|
unative32_t unative32;
|
||||||
|
unative40_t unative40;
|
||||||
|
unative48_t unative48;
|
||||||
|
unative56_t unative56;
|
||||||
|
unative64_t unative64;
|
||||||
|
|
||||||
|
aligned_big16_t aligned_big16;
|
||||||
|
aligned_big32_t aligned_big32;
|
||||||
|
aligned_big64_t aligned_big64;
|
||||||
|
|
||||||
|
aligned_ubig16_t aligned_ubig16;
|
||||||
|
aligned_ubig32_t aligned_ubig32;
|
||||||
|
aligned_ubig64_t aligned_ubig64;
|
||||||
|
|
||||||
|
aligned_little16_t aligned_little16;
|
||||||
|
aligned_little32_t aligned_little32;
|
||||||
|
aligned_little64_t aligned_little64;
|
||||||
|
|
||||||
|
aligned_ulittle16_t aligned_ulittle16 ;
|
||||||
|
aligned_ulittle32_t aligned_ulittle32 ;
|
||||||
|
aligned_ulittle64_t aligned_ulittle64 ;
|
||||||
|
|
||||||
|
VERIFY(big8.data() == reinterpret_cast<const char *>(&big8));
|
||||||
|
VERIFY(big16.data() == reinterpret_cast<const char *>(&big16));
|
||||||
|
VERIFY(big24.data() == reinterpret_cast<const char *>(&big24));
|
||||||
|
VERIFY(big32.data() == reinterpret_cast<const char *>(&big32));
|
||||||
|
VERIFY(big40.data() == reinterpret_cast<const char *>(&big40));
|
||||||
|
VERIFY(big48.data() == reinterpret_cast<const char *>(&big48));
|
||||||
|
VERIFY(big56.data() == reinterpret_cast<const char *>(&big56));
|
||||||
|
VERIFY(big64.data() == reinterpret_cast<const char *>(&big64));
|
||||||
|
|
||||||
|
VERIFY(ubig8.data() == reinterpret_cast<const char *>(&ubig8));
|
||||||
|
VERIFY(ubig16.data() == reinterpret_cast<const char *>(&ubig16));
|
||||||
|
VERIFY(ubig24.data() == reinterpret_cast<const char *>(&ubig24));
|
||||||
|
VERIFY(ubig32.data() == reinterpret_cast<const char *>(&ubig32));
|
||||||
|
VERIFY(ubig40.data() == reinterpret_cast<const char *>(&ubig40));
|
||||||
|
VERIFY(ubig48.data() == reinterpret_cast<const char *>(&ubig48));
|
||||||
|
VERIFY(ubig56.data() == reinterpret_cast<const char *>(&ubig56));
|
||||||
|
VERIFY(ubig64.data() == reinterpret_cast<const char *>(&ubig64));
|
||||||
|
|
||||||
|
VERIFY(little8.data() == reinterpret_cast<const char *>(&little8));
|
||||||
|
VERIFY(little16.data() == reinterpret_cast<const char *>(&little16));
|
||||||
|
VERIFY(little24.data() == reinterpret_cast<const char *>(&little24));
|
||||||
|
VERIFY(little32.data() == reinterpret_cast<const char *>(&little32));
|
||||||
|
VERIFY(little40.data() == reinterpret_cast<const char *>(&little40));
|
||||||
|
VERIFY(little48.data() == reinterpret_cast<const char *>(&little48));
|
||||||
|
VERIFY(little56.data() == reinterpret_cast<const char *>(&little56));
|
||||||
|
VERIFY(little64.data() == reinterpret_cast<const char *>(&little64));
|
||||||
|
|
||||||
|
VERIFY(ulittle8.data() == reinterpret_cast<const char *>(&ulittle8));
|
||||||
|
VERIFY(ulittle16.data() == reinterpret_cast<const char *>(&ulittle16));
|
||||||
|
VERIFY(ulittle24.data() == reinterpret_cast<const char *>(&ulittle24));
|
||||||
|
VERIFY(ulittle32.data() == reinterpret_cast<const char *>(&ulittle32));
|
||||||
|
VERIFY(ulittle40.data() == reinterpret_cast<const char *>(&ulittle40));
|
||||||
|
VERIFY(ulittle48.data() == reinterpret_cast<const char *>(&ulittle48));
|
||||||
|
VERIFY(ulittle56.data() == reinterpret_cast<const char *>(&ulittle56));
|
||||||
|
VERIFY(ulittle64.data() == reinterpret_cast<const char *>(&ulittle64));
|
||||||
|
|
||||||
|
VERIFY(native8.data() == reinterpret_cast<const char *>(&native8));
|
||||||
|
VERIFY(native16.data() == reinterpret_cast<const char *>(&native16));
|
||||||
|
VERIFY(native24.data() == reinterpret_cast<const char *>(&native24));
|
||||||
|
VERIFY(native32.data() == reinterpret_cast<const char *>(&native32));
|
||||||
|
VERIFY(native40.data() == reinterpret_cast<const char *>(&native40));
|
||||||
|
VERIFY(native48.data() == reinterpret_cast<const char *>(&native48));
|
||||||
|
VERIFY(native56.data() == reinterpret_cast<const char *>(&native56));
|
||||||
|
VERIFY(native64.data() == reinterpret_cast<const char *>(&native64));
|
||||||
|
|
||||||
|
VERIFY(unative8.data() == reinterpret_cast<const char *>(&unative8));
|
||||||
|
VERIFY(unative16.data() == reinterpret_cast<const char *>(&unative16));
|
||||||
|
VERIFY(unative24.data() == reinterpret_cast<const char *>(&unative24));
|
||||||
|
VERIFY(unative32.data() == reinterpret_cast<const char *>(&unative32));
|
||||||
|
VERIFY(unative40.data() == reinterpret_cast<const char *>(&unative40));
|
||||||
|
VERIFY(unative48.data() == reinterpret_cast<const char *>(&unative48));
|
||||||
|
VERIFY(unative56.data() == reinterpret_cast<const char *>(&unative56));
|
||||||
|
VERIFY(unative64.data() == reinterpret_cast<const char *>(&unative64));
|
||||||
|
|
||||||
|
VERIFY(aligned_big16.data() == reinterpret_cast<const char *>(&aligned_big16));
|
||||||
|
VERIFY(aligned_big32.data() == reinterpret_cast<const char *>(&aligned_big32));
|
||||||
|
VERIFY(aligned_big64.data() == reinterpret_cast<const char *>(&aligned_big64));
|
||||||
|
|
||||||
|
VERIFY(aligned_ubig16.data() == reinterpret_cast<const char *>(&aligned_ubig16));
|
||||||
|
VERIFY(aligned_ubig32.data() == reinterpret_cast<const char *>(&aligned_ubig32));
|
||||||
|
VERIFY(aligned_ubig64.data() == reinterpret_cast<const char *>(&aligned_ubig64));
|
||||||
|
|
||||||
|
VERIFY(aligned_little16.data() == reinterpret_cast<const char *>(&aligned_little16));
|
||||||
|
VERIFY(aligned_little32.data() == reinterpret_cast<const char *>(&aligned_little32));
|
||||||
|
VERIFY(aligned_little64.data() == reinterpret_cast<const char *>(&aligned_little64));
|
||||||
|
|
||||||
|
VERIFY(aligned_ulittle16.data() == reinterpret_cast<const char *>(&aligned_ulittle16));
|
||||||
|
VERIFY(aligned_ulittle32.data() == reinterpret_cast<const char *>(&aligned_ulittle32));
|
||||||
|
VERIFY(aligned_ulittle64.data() == reinterpret_cast<const char *>(&aligned_ulittle64));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// check_size ------------------------------------------------------------//
|
// check_size ------------------------------------------------------------//
|
||||||
|
|
||||||
void check_size()
|
void check_size()
|
||||||
@@ -572,6 +718,8 @@ namespace
|
|||||||
|
|
||||||
} // unnamed namespace
|
} // unnamed namespace
|
||||||
|
|
||||||
|
// main ------------------------------------------------------------------------------//
|
||||||
|
|
||||||
int main( int argc, char * argv[] )
|
int main( int argc, char * argv[] )
|
||||||
{
|
{
|
||||||
cout << "Usage: "
|
cout << "Usage: "
|
||||||
@@ -586,6 +734,7 @@ int main( int argc, char * argv[] )
|
|||||||
check_size();
|
check_size();
|
||||||
check_alignment();
|
check_alignment();
|
||||||
check_representation_and_range_and_ops();
|
check_representation_and_range_and_ops();
|
||||||
|
check_data();
|
||||||
|
|
||||||
//timing_test<big32_t> ( "big32_t" );
|
//timing_test<big32_t> ( "big32_t" );
|
||||||
//timing_test<aligned_big32_t>( "aligned_big32_t" );
|
//timing_test<aligned_big32_t>( "aligned_big32_t" );
|
||||||
|
@@ -1,11 +1,41 @@
|
|||||||
set ENDIAN_LOCATE_ROOT=%TEMP%\endian-regr
|
@echo off
|
||||||
md %ENDIAN_LOCATE_ROOT% 2>nul
|
echo Special version of boost_test for sandbox version of endian library.
|
||||||
|
xcopy /D %BOOST_TRUNK%\boost-build.jam ..\..\..
|
||||||
|
xcopy /D %BOOST_TRUNK%\Jamroot ..\..\..
|
||||||
|
set BOOST_BUILD_PATH=%BOOST_TRUNK%\tools\build\v2
|
||||||
|
|
||||||
|
if not $%1==$--help goto nohelp
|
||||||
|
echo Invoke: boost_test [-ts toolset] [bjam-options]
|
||||||
|
echo Default -ts is gcc-4.3,msvc-8.0,msvc-9.0express,msvc-10.0express
|
||||||
|
goto done
|
||||||
|
:nohelp
|
||||||
|
|
||||||
|
if $%1==$-ts goto toolset
|
||||||
|
|
||||||
echo Begin test processing...
|
echo Begin test processing...
|
||||||
bjam --dump-tests includes=/boost/trunk "-sALL_LOCATE_TARGET=%ENDIAN_LOCATE_ROOT%" %* >bjam.log 2>&1
|
bjam include=%BOOST_TRUNK% --v2 --dump-tests --toolset=gcc-4.3,msvc-8.0,msvc-9.0express,msvc-10.0express %* >bjam.log 2>&1
|
||||||
|
goto jam_log
|
||||||
|
|
||||||
|
:toolset
|
||||||
|
echo Begin test processing...
|
||||||
|
bjam include=%BOOST_TRUNK% --v2 --dump-tests --toolset=%2 %3 %4 %5 %6 %7 %8 %9 >bjam.log 2>&1
|
||||||
|
|
||||||
|
:jam_log
|
||||||
echo Begin log processing...
|
echo Begin log processing...
|
||||||
process_jam_log %ENDIAN_LOCATE_ROOT% <bjam.log
|
process_jam_log --v2 <bjam.log
|
||||||
start bjam.log
|
start bjam.log
|
||||||
|
|
||||||
echo Begin compiler status processing...
|
echo Begin compiler status processing...
|
||||||
compiler_status --locate-root %ENDIAN_LOCATE_ROOT% ..\..\.. test_status.html test_links.html
|
call boost_relative_root
|
||||||
|
rem compiler_status barfs on a relative root, so convert it to absolute
|
||||||
|
dir %BOOST_RELATIVE_ROOT% | grep " Directory of " >%TEMP%\babsr.bat
|
||||||
|
%UTIL%\change %TEMP%\babsr.bat " Directory of " "set BOOST_TEST_ABS_ROOT=" >nul
|
||||||
|
%UTIL%\change %TEMP%\babsr.bat "C:" "c:" >nul
|
||||||
|
%UTIL%\change %TEMP%\babsr.bat "D:" "d:" >nul
|
||||||
|
%UTIL%\change %TEMP%\babsr.bat "E:" "e:" >nul
|
||||||
|
%UTIL%\change %TEMP%\babsr.bat "F:" "f:" >nul
|
||||||
|
call %TEMP%\babsr.bat
|
||||||
|
compiler_status --v2 %BOOST_TEST_ABS_ROOT% test_status.html test_links.html
|
||||||
start test_status.html
|
start test_status.html
|
||||||
|
|
||||||
|
:done
|
||||||
|
@@ -13,7 +13,7 @@ md libs\integer\example
|
|||||||
md libs\integer\test
|
md libs\integer\test
|
||||||
popd
|
popd
|
||||||
copy ..\..\boost.png \temp\%1
|
copy ..\..\boost.png \temp\%1
|
||||||
copy ..\..\boost\doc\html\minimal.css \temp\%1\doc\html
|
copy ..\..\doc\html\minimal.css \temp\%1\doc\html
|
||||||
copy ..\..\boost\binary_stream.hpp \temp\%1\boost
|
copy ..\..\boost\binary_stream.hpp \temp\%1\boost
|
||||||
copy ..\..\boost\integer\endian.hpp \temp\%1\boost\integer
|
copy ..\..\boost\integer\endian.hpp \temp\%1\boost\integer
|
||||||
copy ..\..\boost\integer\endian_binary_stream.hpp \temp\%1\boost\integer
|
copy ..\..\boost\integer\endian_binary_stream.hpp \temp\%1\boost\integer
|
||||||
|
Reference in New Issue
Block a user