Thursday, April 18, 2019

How to add commend in "macro function" or #define ?

int small_func(int a)
{
    // input plus two
    return (a + 2);
}

#define SMALL_FUNC(a) ({ \
    int result;
    do { \
        /* input plus two */ \
        result = a + 2; \
    } while(0); \
    result; \
})

How to Add Comments to Macros

for loop multiple conditions

what is the right?
1. for (i = 0, j = 0; i < loop, j < loop2; i++, j++)
2. for (i = 0, j = 0; (i < loop) && (j < loop2); i++, j++)

The answers are
Are multiple conditions allowed in a for loop?
GeeksforGeeks: Output of C Program | Set 22, question 2

for example
i = 1, 2; is same as i = 2;

Wednesday, April 17, 2019

TI DSP memory & memory map

L2SRAM: very very fast
MSMCSRAM (Multi-core Shared Memory Controller, SRAM): very fast
DDR3: fast

TI Linker Command File Primer