memesearch
Overcomplicated Linear Function

Overcomplicated Linear Function

Download Find similar pictures
Text on the meme
f(x) = coefficient * x + intercept Too simple? D'accord, let's extend this with a division, rounding, and saturation : void sFC(unsigned short * pDst, short * pSrc, short coeff, sh { int res; do { res = *pSrc++ * coeff + intercept; if (res & 0x80) res += 256; res >>= 8; if (res < 0) res = 0; if (res>0xffff) res = 0xffff; *pDst++ = (unsigned short) res; } while (--count); } The C function above is quite self explanatory. It does multiplication, addition, division (right shift) with roundings, and saturates to 0 to 65535 (16bit).
What it means

A screenshot presents a supposedly simple linear function, then expands it into dense C code with fixed-point arithmetic, rounding, shifting, and saturation. The joke is that a basic formula becomes absurdly complicated in real low-level implementation, making it a relatable reaction to overengineering or unexpectedly difficult programming tasks. EN: A screenshot presents a supposedly simple linear function, then expands it into dense C code with fixed-point arithmetic, rounding, shifting, and saturation. The joke is that a basic formula becomes absurdly complicated in real low-level implementation, making it a relatable reaction to overengineering or unexpectedly difficult programming tasks.

Objects
Tags
Source
Type
image
Size
800×470 · 58.3 KiB
Mood
sarcastic, relatable
Language
en
Added