On Apr 20, 12:17 pm, "Leigh Johnston" <le...@i42.co.uk> wrote:
> "Keith H Duggar" wrote:
> > On Apr 20, 11:55 am, "Leigh Johnston" <le...@i42.co.uk> wrote:
> >> Keith H Duggar wrote:
> >> > I think you will be very interested in this site:
>
> >> > http://graphics.stanford.edu/~seander/bithacks.html
>
> >> > However, please use with restraint and caution.
>
> >> Interestingly that site of yours has the following suggestion:
>
> >> Compute the integer absolute value (abs) without branching
> >> int v; // we want to find the absolute value of v
> >> unsigned int r; // the result goes here
> >> int const mask = v >> sizeof(int) * CHAR_BIT - 1;
>
> >> Gosh, using an "unsigned int" to store an integer absolute value? Who
> >> would
> >> have thought it. 
>
> > Geez I didn't know ... oh wait! I actually /contributed/ to
> > that section:
>
> > "On March 14, 2004, Keith H. Duggar sent me the patented
> > variation above; it is superior to the one I initially came
> > up with, r=(+1|(v>>(sizeof(int)*CHAR_BIT-1)))*v, because a
> > multiply is not used."
>
> > PWNED ... again.
>
> > FYI there is also an /intentional/ right shift of a signed int.
> > I bet you think that is "wrong" just like Alf's vector reserve
> > hack.
>
> > Also, int r gives the exact same results and that is what I use
> > in my personal implementation of that hack. I must be a "use int
> > everywhere" troll ... who expertly uses signed AND unsigned.
>
> > KHD
>
> Typical troll, saying someone is pwned when it is they who are in fact the
> pwned. Yes I saw your name there before I posted
LMAO ... pathetic liar. We have AMPLE evidence that your ADHD and
proclivity for selection bias would have prevented you from reading
ANYTHING past "unsigned int r" before IMMEDIATELY regurgitating a
post.
You fail.
KHD