utils icon indicating copy to clipboard operation
utils copied to clipboard

cmov: add correct usage examples for both `Cmov` and `CmovEq`

Open brxken128 opened this issue 2 years ago • 1 comments

I plan to get these done later today also, and they'll follow the tests as a rough example (but obviously cleaner, easier to understand and commented so users know what's going on).

I plan to add warnings about using Cmov directly, as it would act more of an optimisation barrier if a condition is set to x == y.

I may also add warnings about branching in general, and using the ^ operator where the functions provided by CmovEq aren't adequate (which will be extremely unlikely but still probably worth noting). I'll also briefly explain why using == is bad, but I'm no branching expert so that may require some tweaking.

I'll try to adhere to the RustCrypto example format in order to reduce PR review time, and for consistency.

I think I'll try and get #920 fixed up first though.

brxken128 avatar Jun 18 '23 11:06 brxken128

Examples would be really nice, current docs are somewhat confusing and if not tests I'd be basically impossible to use, but even with tests it not trivial to understand CmovEq. A simple example with brief explanation would go a long way.

nazar-pc avatar Feb 15 '25 19:02 nazar-pc