%Fixing line spacing in algorithm captions
\makeatletter
\patchcmd{\algocf@latexcaption}{#3}{#3\endgraf}{}{}
\makeatother

%Configure Algorithm
\SetAlFnt{\footnotesize}
%\newcommand{\xAlCapSty}[1]{\small\sffamily\bfseries\MakeUppercase{#1}}
%\SetAlCapSty{xAlCapSty}
\newcommand{\xAlCapSty}[1]{#1}
\SetAlCapSty{xAlCapSty}
\SetAlCapSkip{0.5em}
\SetAlCapFnt{\footnotesize}
\SetAlCapNameFnt{\footnotesize}
%\SetAlCapSkip{1em}

%\newcommand{\xCommentSty}[1]{\scriptsize\ttfamily\textcolor{blue}{#1}}
%\newcommand{\xCommentSty}[1]{\footnotesize\ttfamily\textcolor{darkgray}{#1}}
\newcommand{\xCommentSty}[1]{\scriptsize\ttfamily\textcolor{darkgray}{#1}}
\SetCommentSty{xCommentSty}
\SetSideCommentRight
\DontPrintSemicolon


%Special Keywords
\SetKw{KwBy}{by}
\SetKw{KwSync}{\hrulefill~sync~\hrulefill}
\SetKw{KwSyncThreads}{\hrulefill~syncthreads~\hrulefill}
\SetKw{KwFence}{\hrulefill~fence~\hrulefill}

\SetKwFor{For}{for}{}{end}
\SetKwBlock{KwDots}{...}{...}

\SetFuncSty{textbf}
\SetKwFunction{KwTex}{tex2d}

\newcommand{\shfl}[1]{shfl\_#1}
\SetKwFunction{KwShflXor}{\shfl{xor}}
\SetKwFunction{KwShflDown}{\shfl{down}}
\SetKwFunction{KwFloor}{floor}


\SetKwInput{KwShMem}{Shared}
\SetKwInput{KwAssume}{Assume}
%\SetKw{KwShMem}{Shared}



%Math
%\newcommand{\eq}{\leftarrow}
%\newcommand{\ifeq}{==}
%\newcommand{\vmul}{\mathbin{\circ}}
%\newcommand{\mul}{\mathbin{\bullet}} %circ, bullet, times, cdot
%\newcommand{\idiv}{\mathbin{\backslash}}
%\newcommand{\fconst}[1]{#1f}

\newcommand{\eq}{=}
\newcommand{\ifeq}{==}
\newcommand{\vmul}{\mathbin{*}}
\newcommand{\mul}{\mathbin{*}}
\newcommand{\idiv}{\mathbin{/}}
\newcommand{\imod}{\mathbin{\%}}
\newcommand{\aeq}{\mathrel{+}=}
\newcommand{\seq}{\mathrel{-}=}
\newcommand{\meq}{\mathrel{\mul}=}
\newcommand{\deq}{\mathrel{\idiv}=}
\newcommand{\fconst}[1]{#1}
\newcommand{\fconstf}[1]{#1f}
\newcommand{\vfloat}[1]{\tilde{#1}}
\newcommand{\vdata}[1]{\vec{#1}}
\newcommand{\vx}[1]{#1.x}
\newcommand{\vy}[1]{#1.y}
\newcommand{\vz}[1]{#1.z}
\newcommand{\vw}[1]{#1.w}
\newcommand{\vlist}[1]{\{#1\}}

\newcommand{\shmem}[1]{#1^S}
\newcommand{\cmem}[1]{#1^C}
\newcommand{\gmem}[1]{#1^G}
%\newcommand{\shmem}[1]{#1^{\encircled{S}}}
%\newcommand{\cmem}[1]{#1^{\encircled{C}}}
%\newcommand{\gmem}[1]{#1^{\encircled{G}}}


%mapping variants
%\newcommand{\ver}[2]{#2^{#1}}
\newcommand{\ver}[2]{#2^{\encircled{#1}}}

\newcommand{\cast}[2]{\textbf{*(#1)}\textbf{(}\textbf{\&}#2\textbf{)}}



%\newcommand{\ForTo}[4]{\For{$#1 \eq #2$ \KwTo #3}{#4}}
\newcommand{\ForTo}[4]{\For{($#1 \eq #2$; $#1 < #3$; $#1 \mathrel{+}= 1$)}{#4}}
%\newcommand{\ForToBy}[5]{\For{$#1 \eq #2$ \KwTo #3 \KwBy #4}{#5}}
\newcommand{\ForToBy}[5]{\For{($#1 \eq #2$; $#1 < #3$; $#1 \mathrel{+}= #4$)}{#5}}
\newcommand{\CFor}[4]{\For{($#1$; $#2$; $#3$)}{#4}}
