This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F2808: Cast in 'ConfigCpuTimer()' confuses me

Part Number: TMS320F2808


In 'DSP280x_CpuTimers.c', the function below multiplies two 'float's, then casts the result to 'long', then lets assignment do the final cast to 'unsigned long' ... and am baffled by it. Is this a sign-extension idiom? (I almost never do floating-point calculations; hence, the question.)

    void ConfigCpuTimer(struct CPUTIMER_VARS *Timer, float Freq, float Period) {
    Uint32  temp;
    ...
    temp = (long) (Freq * Period);