\doxysection{intrinsics.\+hpp}
\hypertarget{intrinsics_8hpp_source}{}\label{intrinsics_8hpp_source}\index{ginkgo/core/base/intrinsics.hpp@{ginkgo/core/base/intrinsics.hpp}}

\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{comment}{//\ SPDX-\/FileCopyrightText:\ 2017\ -\/\ 2025\ The\ Ginkgo\ authors}}
\DoxyCodeLine{00002\ \textcolor{comment}{//}}
\DoxyCodeLine{00003\ \textcolor{comment}{//\ SPDX-\/License-\/Identifier:\ BSD-\/3-\/Clause}}
\DoxyCodeLine{00004\ }
\DoxyCodeLine{00005\ \textcolor{preprocessor}{\#ifndef\ GKO\_PUBLIC\_CORE\_BASE\_INTRINSICS\_HPP\_}}
\DoxyCodeLine{00006\ \textcolor{preprocessor}{\#define\ GKO\_PUBLIC\_CORE\_BASE\_INTRINSICS\_HPP\_}}
\DoxyCodeLine{00007\ }
\DoxyCodeLine{00008\ }
\DoxyCodeLine{00009\ \textcolor{preprocessor}{\#include\ <bitset>}}
\DoxyCodeLine{00010\ }
\DoxyCodeLine{00011\ \textcolor{preprocessor}{\#include\ <ginkgo/core/base/types.hpp>}}
\DoxyCodeLine{00012\ }
\DoxyCodeLine{00013\ }
\DoxyCodeLine{00014\ \textcolor{keyword}{namespace\ }\doxymbox{\hyperlink{namespacegko}{gko}}\ \{}
\DoxyCodeLine{00015\ \textcolor{keyword}{namespace\ }detail\ \{}
\DoxyCodeLine{00016\ }
\DoxyCodeLine{00017\ }
\DoxyCodeLine{00021\ GKO\_ATTRIBUTES\ GKO\_INLINE\ \textcolor{keywordtype}{int}\ popcount(\doxymbox{\hyperlink{namespacegko_a7cf056fa904140b50658e0637fba428c}{uint32}}\ bitmask)}
\DoxyCodeLine{00022\ \{}
\DoxyCodeLine{00023\ \textcolor{preprocessor}{\#if\ defined(\_\_CUDA\_ARCH\_\_)\ ||\ defined(\_\_HIP\_DEVICE\_COMPILE\_\_)}}
\DoxyCodeLine{00024\ \ \ \ \ \textcolor{keywordflow}{return}\ \_\_popc(\textcolor{keyword}{static\_cast<}\textcolor{keywordtype}{unsigned}\textcolor{keyword}{>}(bitmask));}
\DoxyCodeLine{00025\ \textcolor{preprocessor}{\#else}}
\DoxyCodeLine{00026\ \ \ \ \ std::bitset<32>\ bits\{bitmask\};}
\DoxyCodeLine{00027\ \ \ \ \ \textcolor{keywordflow}{return}\ bits.count();}
\DoxyCodeLine{00028\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00029\ \}}
\DoxyCodeLine{00030\ }
\DoxyCodeLine{00031\ }
\DoxyCodeLine{00033\ GKO\_ATTRIBUTES\ GKO\_INLINE\ \textcolor{keywordtype}{int}\ popcount(\doxymbox{\hyperlink{namespacegko_a09ee89da532d8b1fa6fdecec2d20b9bf}{uint64}}\ bitmask)}
\DoxyCodeLine{00034\ \{}
\DoxyCodeLine{00035\ \textcolor{preprocessor}{\#if\ defined(\_\_CUDA\_ARCH\_\_)\ ||\ defined(\_\_HIP\_DEVICE\_COMPILE\_\_)}}
\DoxyCodeLine{00036\ \ \ \ \ \textcolor{keywordflow}{return}\ \_\_popcll(\textcolor{keyword}{static\_cast<}\textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{long}\ \textcolor{keywordtype}{long}\textcolor{keyword}{>}(bitmask));}
\DoxyCodeLine{00037\ \textcolor{preprocessor}{\#else}}
\DoxyCodeLine{00038\ \ \ \ \ std::bitset<64>\ bits\{bitmask\};}
\DoxyCodeLine{00039\ \ \ \ \ \textcolor{keywordflow}{return}\ bits.count();}
\DoxyCodeLine{00040\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00041\ \}}
\DoxyCodeLine{00042\ }
\DoxyCodeLine{00043\ }
\DoxyCodeLine{00044\ \}\ \ \textcolor{comment}{//\ namespace\ detail}}
\DoxyCodeLine{00045\ \}\ \ \textcolor{comment}{//\ namespace\ gko}}
\DoxyCodeLine{00046\ }
\DoxyCodeLine{00047\ \textcolor{preprocessor}{\#endif\ \ }\textcolor{comment}{//\ GKO\_PUBLIC\_CORE\_BASE\_INTRINSICS\_HPP\_}}

\end{DoxyCode}
