July 29, 2012

Multiplication/Division by constant

One application needed to divide the signal to obtain 20 percent of the actual signal. Therefore I post some sites.

Multiplication-by-a-Fixed-Point-Constant [eetimes.com/]
[www.cs.uaf.edu/~cs301/notes/]
Multiplying-normalized-16-bit-numbers [ssp.impulsetrain.com]

Division
Fast-Faster-Fastest-Code-Integer-division [forums.parallax.com]
Division-of-integers-by-constants [embeddedgurus.com]

Reciprocal multiplication [homepage.cs.uiowa.edu]
Well explained how to use fixed point arithmetic

Division [hackersdelight.org] 
Pdf document

C Right-Left Rule

Have a problem to distinguish some declarationsin the code? The rule right to left is what you have been looking for.

C right-left rule [ieng9.ucsd.edu/~cs30x/]

Will it optimize?

This article describes the optimization with GCC compiler and provides few examples with answers.

Will it optimize [ridiculousfish.com/blog/]

Loop unwinding

Loop unwinding might not bring any improvement in the speed because the compilers have been improved . Anyway, it's pleasant reading about the history :)

Loop unwinding [http://en.wikipedia.org]

Detailed explanation of SWITCH statement
Duff's device [tenaciousc.com]

A reusable duff device [drdobbs.com]

Duff device [www.lysator.liu.se/c/]

How does duffs device work [stackoverflow.com]

If - switch - jump table

What is faster at the moment?  If-else , switch or jump table? These 2 documents clarify details about speed and size.

[rmbconsulting.us/Publications]
ESC_Boston_01_304_paper [http://www.open-std.org/jtc1/sc22/wg21]

C language FAQ

Have you ever had a question and spent minutes/hours to get proper answer in C language area? Here's one of the best available FAQ. Great resource !

C FAQ [www.c-faq.com/index.html]

Arrays and pointers

Hello,

I was struggling with 2D dimensional array last week, therefore small research shown the best available explanation why int **array is not same as int array[][]

Arrays and pointers in C [ibiblio.org/pub/languages]

July 1, 2012

Shifting in C

Shifting bits might get unpredictable sometimes.  Shifting unsigned number is defined but for signed numbers, it's implementation defined. Compiler can preserve highest bit set (sign) or fill it with a zero.

Right Shift on signed types [gustedt.wordpress.com]

Shift-Right Versus Divide in the C Language [plunk.org/~grantham]

Bitwise shifting [lispmachine.wordpress.com]