/usr/include/xtensor/xlayout.hpp is in xtensor-dev 0.10.11-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | /***************************************************************************
* Copyright (c) 2016, Johan Mabille, Sylvain Corlay and Wolf Vollprecht *
* *
* Distributed under the terms of the BSD 3-Clause License. *
* *
* The full license is in the file LICENSE, distributed with this software. *
****************************************************************************/
#ifndef XLAYOUT_HPP
#define XLAYOUT_HPP
namespace xt
{
/*! layout_type enum for xcontainer based xexpressions */
enum class layout_type
{
/*! dynamic layout_type: you can reshape to row major, column major, or use custom strides */
dynamic = 0x00,
/*! layout_type compatible with all others */
any = 0xFF,
/*! row major layout_type */
row_major = 0x01,
/*! column major layout_type */
column_major = 0x02
};
/**
* Implementation of the following logical table:
*
* @verbatim
| d | a | r | c |
--+---+---+---+---+
d | d | d | d | d |
a | d | a | r | c |
r | d | r | r | d |
c | d | c | d | c |
d = dynamic, a = any, r = row_major, c = column_major.
@endverbatim
* Using bitmasks to avoid nested if-else statements.
*
* @param args the input layouts.
* @return the output layout, computed with the previous logical table.
*/
template <class... Args>
constexpr layout_type compute_layout(Args... args) noexcept;
constexpr layout_type default_assignable_layout(layout_type l) noexcept;
/******************
* Implementation *
******************/
namespace detail
{
constexpr layout_type compute_layout_impl() noexcept
{
return layout_type::any;
}
constexpr layout_type compute_layout_impl(layout_type l) noexcept
{
return l;
}
constexpr layout_type compute_layout_impl(layout_type lhs, layout_type rhs) noexcept
{
using type = std::underlying_type_t<layout_type>;
return layout_type(static_cast<type>(lhs) & static_cast<type>(rhs));
}
template <class... Args>
constexpr layout_type compute_layout_impl(layout_type lhs, Args... args) noexcept
{
return compute_layout_impl(lhs, compute_layout_impl(args...));
}
}
template <class... Args>
constexpr layout_type compute_layout(Args... args) noexcept
{
return detail::compute_layout_impl(args...);
}
constexpr layout_type default_assignable_layout(layout_type l) noexcept
{
return (l == layout_type::row_major || l == layout_type::column_major) ?
l : layout_type::row_major;
}
}
#endif
|