<div dir="ltr"><div>Hello,</div><div><br></div><div>I've discovered that the remAddr# primop documentation is inconsistent with the implementation.</div><div>According to the docs (primops.txt.pp) the remAddr# should be the same as remInt#.</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><pre class="gmail-code gmail-highlight" lang="puppet"><span id="gmail-LC1993" class="gmail-line" lang="puppet"><span class="gmail-s1">primop AddrRemOp "remAddr#" GenPrimOp Addr# -> Int# -> Int#</span></span>
<span id="gmail-LC1994" class="gmail-line" lang="puppet"><span class="gmail-s1"> {Return the remainder when the {\tt Addr\#} arg, treated like an {\tt Int\#},</span></span>
<span id="gmail-LC1995" class="gmail-line" lang="puppet"><span class="gmail-s1"> is divided by the {\tt Int\#} arg.}</span></span>
</pre></div></blockquote><div>But it is implemented with the mo_wordURem instruction, just like the WordRemOp primop.</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>GHC/StgToCmm/Prim.hs:</div></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><code><span class="gmail-kt">AddrRemOp</span> <span class="gmail-o">-></span> <span class="gmail-nf">\</span><span class="gmail-n">args</span> <span class="gmail-o">-></span> <span class="gmail-n">opTranslate</span> <span class="gmail-n">args</span> <span class="gmail-p">(</span><span class="gmail-n">mo_wordURem</span> <span class="gmail-n">platform</span><span class="gmail-p">)</span></code></div></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><code><span class="gmail-kt">WordRemOp</span> <span class="gmail-o">-></span> <span class="gmail-nf">\</span><span class="gmail-n">args</span> <span class="gmail-o">-></span> <span class="gmail-n">opTranslate</span> <span class="gmail-n">args</span> <span class="gmail-p">(</span><span class="gmail-n">mo_wordURem</span> <span class="gmail-n">platform</span><span class="gmail-p">)</span></code> <br></div></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><code><span class="gmail-kt">IntRemOp</span> <span class="gmail-o">-></span> <span class="gmail-nf">\</span><span class="gmail-n">args</span> <span class="gmail-o">-></span> <span class="gmail-n">opTranslate</span> <span class="gmail-n">args</span> <span class="gmail-p">(</span><span class="gmail-n">mo_wordSRem</span> <span class="gmail-n">platform</span><span class="gmail-p">)</span></code></div></blockquote><div><br></div><div>Which one is correct, the docs or the implementation?</div><div><br></div><div>Regards,</div><div>Csaba Hruska<br></div></div>