mirror of
https://github.com/boostorg/align.git
synced 2026-01-22 17:02:10 +00:00
37 lines
814 B
C++
37 lines
814 B
C++
/*
|
|
(c) 2015 Glen Joseph Fernandes
|
|
<glenjofe -at- gmail.com>
|
|
|
|
Distributed under the Boost Software
|
|
License, Version 1.0.
|
|
http://boost.org/LICENSE_1_0.txt
|
|
*/
|
|
#include <boost/align/assume_aligned.hpp>
|
|
#include <boost/align/is_aligned.hpp>
|
|
#include <boost/core/lightweight_test.hpp>
|
|
|
|
void test()
|
|
{
|
|
char s[128];
|
|
char* p = s;
|
|
while (!boost::alignment::is_aligned(p, 128)) {
|
|
p++;
|
|
}
|
|
void* q = p;
|
|
BOOST_ALIGN_ASSUME_ALIGNED(q, 1);
|
|
BOOST_ALIGN_ASSUME_ALIGNED(q, 2);
|
|
BOOST_ALIGN_ASSUME_ALIGNED(q, 4);
|
|
BOOST_ALIGN_ASSUME_ALIGNED(q, 8);
|
|
BOOST_ALIGN_ASSUME_ALIGNED(q, 16);
|
|
BOOST_ALIGN_ASSUME_ALIGNED(q, 32);
|
|
BOOST_ALIGN_ASSUME_ALIGNED(q, 64);
|
|
BOOST_ALIGN_ASSUME_ALIGNED(q, 128);
|
|
BOOST_TEST(q == p);
|
|
}
|
|
|
|
int main()
|
|
{
|
|
test();
|
|
return boost::report_errors();
|
|
}
|