Email or username:

Password:

Forgot your password?
Top-level
Devil Lu Linvega

if(a > b) {
return a + b;
}
else {
return a - b;
}

It quotes the add function and transforms it to a subtraction without branching.

6 comments | Expand all CWs
cancel

@neauoire blursed?

Devil Lu Linvega

@cancel curlsed

andreer

@neauoire @neauoire For what it does, it seems to be a very consise implementation (and likely fast too, at least in a non-pipelined execution). I pondered over it for a while though ... Can you reveal any of what it is used for? Some transformation of coordinates?

Devil Lu Linvega

@andreer It's used in a routine that returns an offset to be used to find a routine in a lookup table of pointers. It's part of a project that uses cons cells.

manuelcaeiro ☕

@neauoire
You will never know how useful that might have been for me - who was overthinking some solution. 👍

DHeadshot's Alt

@neauoire
This feels very "Story of Mel"...

Go Up