summaryrefslogtreecommitdiff
path: root/boost/align/detail/align.hpp
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2016-10-06 10:30:07 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2016-10-06 10:32:57 +0900
commit71d216b90256936a9638f325af9bc69d720e75de (patch)
tree9c5f682d341c7c88ad0c8e3d4b262e00b6fb691a /boost/align/detail/align.hpp
parent733b5d5ae2c5d625211e2985ac25728ac3f54883 (diff)
downloadboost-71d216b90256936a9638f325af9bc69d720e75de.tar.gz
boost-71d216b90256936a9638f325af9bc69d720e75de.tar.bz2
boost-71d216b90256936a9638f325af9bc69d720e75de.zip
Imported Upstream version 1.59.0
Change-Id: I2dde00f4eca71df3eea9d251dcaecde18a6c90a5 Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'boost/align/detail/align.hpp')
-rw-r--r--boost/align/detail/align.hpp46
1 files changed, 24 insertions, 22 deletions
diff --git a/boost/align/detail/align.hpp b/boost/align/detail/align.hpp
index e3a90dffda..00be6fd6aa 100644
--- a/boost/align/detail/align.hpp
+++ b/boost/align/detail/align.hpp
@@ -1,10 +1,10 @@
/*
- (c) 2014 Glen Joseph Fernandes
- glenjofe at gmail dot com
+(c) 2014 Glen Joseph Fernandes
+glenjofe at gmail dot com
- Distributed under the Boost Software
- License, Version 1.0.
- http://boost.org/LICENSE_1_0.txt
+Distributed under the Boost Software
+License, Version 1.0.
+http://boost.org/LICENSE_1_0.txt
*/
#ifndef BOOST_ALIGN_DETAIL_ALIGN_HPP
#define BOOST_ALIGN_DETAIL_ALIGN_HPP
@@ -15,24 +15,26 @@
#include <cstddef>
namespace boost {
- namespace alignment {
- inline void* align(std::size_t alignment, std::size_t size,
- void*& ptr, std::size_t& space)
- {
- BOOST_ASSERT(detail::is_alignment(alignment));
- std::size_t n = detail::address_t(ptr) & (alignment - 1);
- if (n != 0) {
- n = alignment - n;
- }
- void* p = 0;
- if (n <= space && size <= space - n) {
- p = static_cast<char*>(ptr) + n;
- ptr = p;
- space -= n;
- }
- return p;
- }
+namespace alignment {
+
+inline void* align(std::size_t alignment, std::size_t size,
+ void*& ptr, std::size_t& space)
+{
+ BOOST_ASSERT(detail::is_alignment(alignment));
+ std::size_t n = detail::address_t(ptr) & (alignment - 1);
+ if (n != 0) {
+ n = alignment - n;
+ }
+ void* p = 0;
+ if (n <= space && size <= space - n) {
+ p = static_cast<char*>(ptr) + n;
+ ptr = p;
+ space -= n;
}
+ return p;
}
+} /* :alignment */
+} /* :boost */
+
#endif