2197e0dfd56eb2c75efec479077e316844570180.pygtex 4.39 KB
\begin{Verbatim}[commandchars=\\\{\}]
\PYG{k}{namespace} \PYG{n}{vecCore} \PYG{p}{\PYGZob{}}

\PYG{k}{template} \PYG{o}{\PYGZlt{}}\PYG{k}{typename} \PYG{n}{T}\PYG{o}{\PYGZgt{}} \PYG{k}{struct} \PYG{n}{TypeTraits}\PYG{p}{;}
\PYG{k}{template} \PYG{o}{\PYGZlt{}}\PYG{k}{typename} \PYG{n}{T}\PYG{o}{\PYGZgt{}} \PYG{k}{using} \PYG{n}{Mask} \PYG{err}{  }\PYG{o}{=} \PYG{k}{typename} \PYG{n}{TypeTraits}\PYG{o}{\PYGZlt{}}\PYG{n}{T}\PYG{o}{\PYGZgt{}::}\PYG{n}{MaskType}\PYG{p}{;}
\PYG{k}{template} \PYG{o}{\PYGZlt{}}\PYG{k}{typename} \PYG{n}{T}\PYG{o}{\PYGZgt{}} \PYG{k}{using} \PYG{n}{Index} \PYG{err}{ }\PYG{o}{=} \PYG{k}{typename} \PYG{n}{TypeTraits}\PYG{o}{\PYGZlt{}}\PYG{n}{T}\PYG{o}{\PYGZgt{}::}\PYG{n}{IndexType}\PYG{p}{;}
\PYG{k}{template} \PYG{o}{\PYGZlt{}}\PYG{k}{typename} \PYG{n}{T}\PYG{o}{\PYGZgt{}} \PYG{k}{using} \PYG{n}{Scalar} \PYG{o}{=} \PYG{k}{typename} \PYG{n}{TypeTraits}\PYG{o}{\PYGZlt{}}\PYG{n}{T}\PYG{o}{\PYGZgt{}::}\PYG{n}{ScalarType}\PYG{p}{;}

\PYG{c+c1}{// Vector Size}
\PYG{k}{template} \PYG{o}{\PYGZlt{}}\PYG{k}{typename} \PYG{n}{T}\PYG{o}{\PYGZgt{}} \PYG{k}{constexpr} \PYG{k+kt}{size\PYGZus{}t} \PYG{n}{VectorSize}\PYG{p}{();}

\PYG{c+c1}{// Get/Set}
\PYG{k}{template} \PYG{o}{\PYGZlt{}}\PYG{k}{typename} \PYG{n}{T}\PYG{o}{\PYGZgt{}} \PYG{n}{Scalar}\PYG{o}{\PYGZlt{}}\PYG{n}{T}\PYG{o}{\PYGZgt{}} \PYG{n}{Get}\PYG{p}{(}\PYG{k}{const} \PYG{n}{T} \PYG{o}{\PYGZam{}}\PYG{n}{v}\PYG{p}{,} \PYG{k+kt}{size\PYGZus{}t} \PYG{n}{i}\PYG{p}{);}
\PYG{k}{template} \PYG{o}{\PYGZlt{}}\PYG{k}{typename} \PYG{n}{T}\PYG{o}{\PYGZgt{}} \PYG{k+kt}{void} \PYG{n}{Set}\PYG{p}{(}\PYG{n}{T} \PYG{o}{\PYGZam{}}\PYG{n}{v}\PYG{p}{,} \PYG{k+kt}{size\PYGZus{}t} \PYG{n}{i}\PYG{p}{,} \PYG{n}{Scalar}\PYG{o}{\PYGZlt{}}\PYG{n}{T}\PYG{o}{\PYGZgt{}} \PYG{k}{const} \PYG{n}{val}\PYG{p}{);}

\PYG{c+c1}{// Load/Store}
\PYG{k}{template} \PYG{o}{\PYGZlt{}}\PYG{k}{typename} \PYG{n}{T}\PYG{o}{\PYGZgt{}} \PYG{k+kt}{void} \PYG{n}{Load}\PYG{p}{(}\PYG{n}{T} \PYG{o}{\PYGZam{}}\PYG{n}{v}\PYG{p}{,} \PYG{n}{Scalar}\PYG{o}{\PYGZlt{}}\PYG{n}{T}\PYG{o}{\PYGZgt{}} \PYG{k}{const} \PYG{o}{*}\PYG{n}{ptr}\PYG{p}{);}
\PYG{k}{template} \PYG{o}{\PYGZlt{}}\PYG{k}{typename} \PYG{n}{T}\PYG{o}{\PYGZgt{}} \PYG{k+kt}{void} \PYG{n}{Store}\PYG{p}{(}\PYG{n}{T} \PYG{k}{const} \PYG{o}{\PYGZam{}}\PYG{n}{v}\PYG{p}{,} \PYG{n}{Scalar}\PYG{o}{\PYGZlt{}}\PYG{n}{T}\PYG{o}{\PYGZgt{}} \PYG{o}{*}\PYG{n}{ptr}\PYG{p}{);}

\PYG{c+c1}{// Gather/Scatter}
\PYG{k}{template} \PYG{o}{\PYGZlt{}}\PYG{k}{typename} \PYG{n}{T}\PYG{p}{,} \PYG{k}{typename} \PYG{n}{S} \PYG{o}{=} \PYG{n}{Scalar}\PYG{o}{\PYGZlt{}}\PYG{n}{T}\PYG{o}{\PYGZgt{}\PYGZgt{}}
\PYG{n}{T} \PYG{n}{Gather}\PYG{p}{(}\PYG{n}{S} \PYG{k}{const} \PYG{o}{*}\PYG{n}{ptr}\PYG{p}{,} \PYG{n}{Index}\PYG{o}{\PYGZlt{}}\PYG{n}{T}\PYG{o}{\PYGZgt{}} \PYG{k}{const} \PYG{o}{\PYGZam{}}\PYG{n}{idx}\PYG{p}{);}

\PYG{k}{template} \PYG{o}{\PYGZlt{}}\PYG{k}{typename} \PYG{n}{T}\PYG{p}{,} \PYG{k}{typename} \PYG{n}{S} \PYG{o}{=} \PYG{n}{Scalar}\PYG{o}{\PYGZlt{}}\PYG{n}{T}\PYG{o}{\PYGZgt{}\PYGZgt{}}
\PYG{k+kt}{void} \PYG{n}{Scatter}\PYG{p}{(}\PYG{n}{T} \PYG{k}{const} \PYG{o}{\PYGZam{}}\PYG{n}{v}\PYG{p}{,} \PYG{n}{S} \PYG{o}{*}\PYG{n}{ptr}\PYG{p}{,} \PYG{n}{Index}\PYG{o}{\PYGZlt{}}\PYG{n}{T}\PYG{o}{\PYGZgt{}} \PYG{k}{const} \PYG{o}{\PYGZam{}}\PYG{n}{idx}\PYG{p}{);}

\PYG{c+c1}{// Masking/Blending}
\PYG{k}{template} \PYG{o}{\PYGZlt{}}\PYG{k}{typename} \PYG{n}{M}\PYG{o}{\PYGZgt{}} \PYG{k+kt}{bool} \PYG{n}{MaskFull}\PYG{p}{(}\PYG{n}{M} \PYG{k}{const} \PYG{o}{\PYGZam{}}\PYG{n}{mask}\PYG{p}{);}
\PYG{k}{template} \PYG{o}{\PYGZlt{}}\PYG{k}{typename} \PYG{n}{M}\PYG{o}{\PYGZgt{}} \PYG{k+kt}{bool} \PYG{n}{MaskEmpty}\PYG{p}{(}\PYG{n}{M} \PYG{k}{const} \PYG{o}{\PYGZam{}}\PYG{n}{mask}\PYG{p}{);}

\PYG{k}{template} \PYG{o}{\PYGZlt{}}\PYG{k}{typename} \PYG{n}{T}\PYG{o}{\PYGZgt{}} \PYG{k+kt}{void} \PYG{n}{MaskedAssign}\PYG{p}{(}\PYG{n}{T} \PYG{o}{\PYGZam{}}\PYG{n}{dst}\PYG{p}{,} \PYG{k}{const} \PYG{n}{Mask}\PYG{o}{\PYGZlt{}}\PYG{n}{T}\PYG{o}{\PYGZgt{}} \PYG{o}{\PYGZam{}}\PYG{n}{mask}\PYG{p}{,} \PYG{k}{const} \PYG{n}{T} \PYG{o}{\PYGZam{}}\PYG{n}{src}\PYG{p}{);}
\PYG{k}{template} \PYG{o}{\PYGZlt{}}\PYG{k}{typename} \PYG{n}{T}\PYG{o}{\PYGZgt{}} \PYG{n}{T} \PYG{n}{Blend}\PYG{p}{(}\PYG{k}{const} \PYG{n}{Mask}\PYG{o}{\PYGZlt{}}\PYG{n}{T}\PYG{o}{\PYGZgt{}} \PYG{o}{\PYGZam{}}\PYG{n}{mask}\PYG{p}{,} \PYG{k}{const} \PYG{n}{T} \PYG{o}{\PYGZam{}}\PYG{n}{src1}\PYG{p}{,} \PYG{k}{const} \PYG{n}{T} \PYG{o}{\PYGZam{}}\PYG{n}{src2}\PYG{p}{);}

\PYG{p}{\PYGZcb{}} \PYG{c+c1}{// namespace vecCore }
\end{Verbatim}