Hacker News new | ask | show | jobs
by abyesilyurt 256 days ago
Thresholding requires branching no?
3 comments

No, you can do that without branching. See https://en.algorithmica.org/hpc/pipelining/branchless/#predi... for example.
As demonstrated in the article, you can compute clamp(x, min, max) with straight-line code.
No, it’s just a math operation and can be applied to any amount of data in parallel.