03.08.2013 Views

Embedded Software and Motor Control Libraries for PXR40xx

Embedded Software and Motor Control Libraries for PXR40xx

Embedded Software and Motor Control Libraries for PXR40xx

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

4.167.2 Arguments<br />

Table 4-204. MLIB_ShBiSat_F32 arguments<br />

Type Name Direction Description<br />

register tFrac32 f32In1 input First value to be shift.<br />

register tS16 s16In2 input The shift amount value.<br />

4.167.3 Return<br />

32-bit fractional value shifted to left or right by the shift amount. The bits beyond the 32bit<br />

boundary are discarded.<br />

4.167.4 Description<br />

Based on sign of second parameter this function shifts the first parameter to right or left<br />

<strong>and</strong> saturate if an overflow is detected. If the sign of second parameter is negative, shift to<br />

right.<br />

Note<br />

The shift amount cannot exceed in magnitude the bit-width of<br />

the shift value, that means must be within the range -31...31.<br />

Otherwise the result of the function is undefined. Due to<br />

effectivity reason this function is implemented as inline <strong>and</strong><br />

thus is not ANSI-C compliant.<br />

4.167.5 Re-entrancy<br />

The function is re-entrant.<br />

4.167.6 Code Example<br />

#include "mlib.h"<br />

tFrac32 f32In1;<br />

tFrac32 f32Out;<br />

tS16 s16In2;<br />

void main(void)<br />

{<br />

// first input = 0.25<br />

<strong>Embedded</strong> <strong>Software</strong> <strong>and</strong> <strong>Motor</strong> <strong>Control</strong> <strong>Libraries</strong> <strong>for</strong> <strong>PXR40xx</strong>, Rev. 1.0<br />

Chapter 4 API References<br />

Freescale Semiconductor, Inc. 649

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!