<div dir="ltr">Hello Haskellers,<div><br></div><div>I'm trying to write a faster popCount function for x86 systems.<br></div><div><br></div><div>I tried cloning the ghc-prim package and repurposing it for my own needs, but it isn't working as hoped.</div><div><br></div><div>In particular, popCnt64# was implemented in GHC.Prim as:</div><div><br></div><div>popCnt64# = let x = x in x<br></div><div><br></div><div>Which shouldn't terminate.  Yet when I call it, it magically finds the C implementation in hs_popcnt64 and returns the correct value.</div><div><br></div><div>My cloned project doesn't behave that way.  Instead it doesn't terminate as I would expect.</div><div><br></div><div>Anyone know what's happening here, if there is a way to make this work or tell me if I'm going about this completely the wrong way?</div><div><br></div><div>Cheers,</div><div><br></div><div>-John</div><div><br></div></div>