Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions source/numerics.tex
Original file line number Diff line number Diff line change
Expand Up @@ -17391,6 +17391,16 @@
template<@\exposconcept{simd-vec-type}@ V>
constexpr typename V::mask_type has_single_bit(const V& v) noexcept;

template<@\exposconcept{simd-vec-type}@ VX, @\exposconcept{simd-vec-type}@ VS>
constexpr VX shl(const VX& x, const VS& s) noexcept;
template<@\exposconcept{simd-vec-type}@ V, class S>
constexpr V shl(const V& x, S s) noexcept;

template<@\exposconcept{simd-vec-type}@ VX, @\exposconcept{simd-vec-type}@ VS>
constexpr VX shr(const VX& x, const VS& s) noexcept;
template<@\exposconcept{simd-vec-type}@ V, class S>
constexpr V shr(const V& x, S s) noexcept;

template<@\exposconcept{simd-vec-type}@ V0, @\exposconcept{simd-vec-type}@ V1>
constexpr V0 rotl(const V0& v, const V1& s) noexcept;
template<@\exposconcept{simd-vec-type}@ V>
Expand Down Expand Up @@ -17592,6 +17602,8 @@
using simd::bit_ceil;
using simd::bit_floor;
using simd::has_single_bit;
using simd::shl;
using simd::shr;
using simd::rotl;
using simd::rotr;
using simd::bit_width;
Expand Down Expand Up @@ -20638,6 +20650,60 @@
\range{0}{V::size()}.
\end{itemdescr}

\indexlibrarymember{shl}{simd}
\indexlibrarymember{shr}{simd}
\begin{itemdecl}
template<@\exposconcept{simd-vec-type}@ VX, @\exposconcept{simd-vec-type}@ VS>
constexpr VX shl(const VX& x, const VS& s) noexcept;
template<@\exposconcept{simd-vec-type}@ VX, @\exposconcept{simd-vec-type}@ VS>
constexpr VX shr(const VX& x, const VS& s) noexcept;
\end{itemdecl}

\begin{itemdescr}
\pnum
\constraints
\begin{itemize}
\item
Each of \tcode{VX::value_type} and \tcode{VS::value_type}
is a signed or unsigned integer type\iref{basic.fundamental},
\item
\tcode{VX::size() == VS::size()} is \tcode{true}, and
\item
\tcode{sizeof(typename VX::value_type) == sizeof(typename VS::value_type)}
is \tcode{true}.
\end{itemize}

\pnum
\returns
A \tcode{basic_vec} object where the $i^\text{th}$ element is initialized to
the result of \tcode{\placeholder{bit-func}(x[$i$], s[$i$])}
for all $i$ in the range \range{0}{VX::size()},
where \tcode{\placeholder{bit-func}} is the corresponding scalar function from \libheader{bit}.
\end{itemdescr}

\indexlibrarymember{shl}{simd}
\indexlibrarymember{shr}{simd}
\begin{itemdecl}
template<@\exposconcept{simd-vec-type}@ V, class S>
constexpr V shl(const V& x, S s) noexcept;
template<@\exposconcept{simd-vec-type}@ V, class S>
constexpr V shr(const V& x, S s) noexcept;
\end{itemdecl}

\begin{itemdescr}
\pnum
\constraints
Each of \tcode{VX::value_type} and \tcode{S}
is a signed or unsigned integer type\iref{basic.fundamental}.

\pnum
\returns
A \tcode{basic_vec} object where the $i^\text{th}$ element is initialized to
the result of \tcode{\placeholder{bit-func}(x[$i$], s)}
for all $i$ in the range \range{0}{VX::size()},
where \tcode{\placeholder{bit-func}} is the corresponding scalar function from \libheader{bit}.
\end{itemdescr}

\indexlibrarymember{rotl}{simd}
\indexlibrarymember{rotr}{simd}
\begin{itemdecl}
Expand Down
3 changes: 2 additions & 1 deletion source/support.tex
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@
#define @\defnlibxname{cpp_lib_bind_back}@ 202306L // freestanding, also in \libheader{functional}
#define @\defnlibxname{cpp_lib_bind_front}@ 202306L // freestanding, also in \libheader{functional}
#define @\defnlibxname{cpp_lib_bit_cast}@ 201806L // freestanding, also in \libheader{bit}
#define @\defnlibxname{cpp_lib_bitops}@ 201907L // freestanding, also in \libheader{bit}
#define @\defnlibxname{cpp_lib_bitops}@ 202606L // freestanding, also in \libheader{bit}
#define @\defnlibxname{cpp_lib_bitset}@ 202306L // also in \libheader{bitset}
#define @\defnlibxname{cpp_lib_bool_constant}@ 201505L // freestanding, also in \libheader{type_traits}
#define @\defnlibxname{cpp_lib_bounded_array_traits}@ 201902L // freestanding, also in \libheader{type_traits}
Expand Down Expand Up @@ -838,6 +838,7 @@
#define @\defnlibxname{cpp_lib_shared_timed_mutex}@ 201402L // also in \libheader{shared_mutex}
#define @\defnlibxname{cpp_lib_shift}@ 202202L // also in \libheader{algorithm}
#define @\defnlibxname{cpp_lib_simd}@ 202603L // also in \libheader{simd}
#define @\defnlibxname{cpp_lib_simd_bitops}@ 202606L // also in \libheader{simd}
#define @\defnlibxname{cpp_lib_simd_complex}@ 202502L // also in \libheader{simd}
#define @\defnlibxname{cpp_lib_simd_permutations}@ 202506L // also in \libheader{simd}
#define @\defnlibxname{cpp_lib_smart_ptr_for_overwrite}@ 202002L // also in \libheader{memory}
Expand Down
48 changes: 48 additions & 0 deletions source/utilities.tex
Original file line number Diff line number Diff line change
Expand Up @@ -16316,6 +16316,12 @@
template<class T>
constexpr int bit_width(T x) noexcept;

// \ref{bit.shift}, shifting
template<class T, class S>
constexpr T shl(T x, S s) noexcept;
template<class T, class S>
constexpr T shr(T x, S s) noexcept;

// \ref{bit.rotate}, rotating
template<class T>
constexpr T rotl(T x, int s) noexcept;
Expand Down Expand Up @@ -16524,6 +16530,48 @@

\end{itemdescr}

\rSec2[bit.shift]{Shifting}

\pnum
Within this subclause,
the result $r$ of an arithmetic operation is
first represented in a hypothetical integer type with sufficient range,
then converted to \tcode{T} as if by \tcode{static_cast<T>(r)}.

\indexlibraryglobal{shl}%
\begin{itemdecl}
template<class T, class S>
constexpr T shl(T x, S s) noexcept;
\end{itemdecl}

\begin{itemdescr}
\pnum
\constraints
Each of \tcode{T} and \tcode{S}
is a signed or unsigned integer type\iref{basic.fundamental}.

\pnum
\returns
$x \times 2^s$ rounded towards negative infinity.
\end{itemdescr}

\indexlibraryglobal{shr}%
\begin{itemdecl}
template<class T, class S>
constexpr T shr(T x, S s) noexcept;
\end{itemdecl}

\begin{itemdescr}
\pnum
\constraints
Each of \tcode{T} and \tcode{S}
is a signed or unsigned integer type\iref{basic.fundamental}.

\pnum
\returns
$x \times 2^{-s}$ rounded towards negative infinity.
\end{itemdescr}

\rSec2[bit.rotate]{Rotating}

\pnum
Expand Down
Loading