-
Notifications
You must be signed in to change notification settings - Fork 778
P2876R3 Proposal to extend std::simd with more constructors and accessors #7997
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19095,6 +19095,8 @@ | |
template<size_t UBytes, class UAbi> | ||
constexpr explicit basic_simd_mask(const basic_simd_mask<UBytes, UAbi>&) noexcept; | ||
template<class G> constexpr explicit basic_simd_mask(G&& gen) noexcept; | ||
constexpr basic_simd_mask(const bitset<size()>& b) noexcept; | ||
constexpr explicit basic_simd_mask(@\libconcept{unsigned_integral}@ auto val) noexcept; | ||
|
||
// \ref{simd.mask.subscr}, \tcode{basic_simd_mask} subscript operators | ||
constexpr value_type operator[](@\exposid{simd-size-type}@) const; | ||
|
@@ -19109,6 +19111,10 @@ | |
template<class U, class A> | ||
constexpr explicit(sizeof(U) != Bytes) operator basic_simd<U, A>() const noexcept; | ||
|
||
// \ref{simd.mask.namedconv}, \tcode{basic_simd_mask} named type convertors | ||
constexpr bitset<size()> to_bitset() const noexcept; | ||
constexpr unsigned long long to_ullong() const; | ||
|
||
// \ref{simd.mask.binary}, \tcode{basic_simd_mask} binary operators | ||
friend constexpr basic_simd_mask | ||
operator&&(const basic_simd_mask&, const basic_simd_mask&) noexcept; | ||
|
@@ -19241,6 +19247,31 @@ | |
\tcode{gen} is invoked exactly once for each $i$, in increasing order of $i$. | ||
\end{itemdescr} | ||
|
||
\begin{itemdecl} | ||
constexpr basic_simd_mask(const bitset<size()>& b) noexcept; | ||
\end{itemdecl} | ||
|
||
\begin{itemdescr} | ||
\pnum | ||
\effects | ||
Initializes the $i^\text{th}$ element with \tcode{b[$i$]} for all $i$ in the | ||
range \range{0}{size()}. | ||
\end{itemdescr} | ||
|
||
\begin{itemdecl} | ||
constexpr explicit basic_simd_mask(@\libconcept{unsigned_integral}@ auto val) noexcept; | ||
\end{itemdecl} | ||
|
||
\begin{itemdescr} | ||
\pnum | ||
\effects | ||
Initializes the first $M$ elements to the corresponding bit values in | ||
\tcode{val}, where $M$ is the smaller of \tcode{size()} and the number of bits in | ||
the value representation \iref{basic.types.general} of the type of \tcode{val}. If | ||
$M$ is less than \tcode{size()}, the remaining elements are initialized to | ||
zero. | ||
\end{itemdescr} | ||
|
||
\rSec3[simd.mask.subscr]{\tcode{basic_simd_mask} subscript operator} | ||
|
||
\begin{itemdecl} | ||
|
@@ -19299,6 +19330,43 @@ | |
\tcode{static_cast<U>(operator[]($i$))}. | ||
\end{itemdescr} | ||
|
||
\rSec3[simd.mask.namedconv]{\tcode{basic_simd_mask} named conversion operators} | ||
|
||
\begin{itemdecl} | ||
constexpr bitset<size()> to_bitset() const noexcept; | ||
\end{itemdecl} | ||
|
||
\begin{itemdescr} | ||
\pnum | ||
\returns | ||
A \tcode{bitset<size()>} object where the $i^\text{th}$ element is initialized to | ||
\tcode{operator[]($i$)} for all $i$ in the range \range{0}{size()}. | ||
\end{itemdescr} | ||
|
||
\begin{itemdecl} | ||
constexpr unsigned long long to_ullong() const; | ||
\end{itemdecl} | ||
|
||
\begin{itemdescr} | ||
\pnum | ||
Let $N$ be the width of \tcode{unsigned long long}. | ||
|
||
\pnum | ||
\expects | ||
\begin{itemize} | ||
\item \tcode{size()} $\le N$, or | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure why you've decided to change what is in the paper via fix-up here. We have tons of wording precedent for
... as dumb as it sounds, but to my knowledge, we don't have any kind of formal decision that would eliminate this. LWG approved this wording, so we may as well keep it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I changed it because that's more consistent with what's in [simd] (i.e., what we did for P1928). I wanted to call that out as a questionable commit / a suggestion and forgot about it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I cannot answer with authority, but we have procedures in https://github.com/cplusplus/draft/wiki/Applying-papers-to-the-Working-Draft for this. To my understanding, we only use commits in the same PR for typo repairs and other things that are broken in the paper wording. If there are stylistic/consistency improvements, those tend to go onto into a separate PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've removed the commit from my Motions 10–13 PR and will submit a separate PR. |
||
\item for all $i$ in the range \range{$N$}{size()}, \tcode{operator[]($i$)} returns \tcode{false}. | ||
\end{itemize} | ||
|
||
\pnum | ||
\returns | ||
The integral value corresponding to the bits in \tcode{*this}. | ||
|
||
\pnum | ||
\throws | ||
Nothing. | ||
\end{itemdescr} | ||
|
||
\rSec2[simd.mask.nonmembers]{Non-member operations} | ||
|
||
\rSec3[simd.mask.binary]{\tcode{basic_simd_mask} binary operators} | ||
|
Uh oh!
There was an error while loading. Please reload this page.