Function Use; Mlib_Shlbi; Available Versions - Freescale Semiconductor DSP56800E User Manual

Mlib
Hide thumbs Also See for DSP56800E:
Table of Contents

Advertisement

2.48.3 Function use

The use of the
MLIB_ShR
#include "mlib.h"
static
frac16_t
f16Result, f16Val;
static
uint16_t
u16Sh;
void main(void)
{
f16Val = FRAC32(-0.354);
u16Sh = 8;
/* f16Result = f16Val >> u16Sh */
f16Result = MLIB_ShR_F16(f16Val, u16Sh);
}

2.49 MLIB_ShLBi

The
MLIB_ShLBi
functions return the arithmetically shifted value to the left a specified
number of times. If the number of shifts is positive, the shift is performed to the left; if
negative, to the right. The function does not saturate the output. See the following
equation:

2.49.1 Available versions

The function is available in the following versions:
• Fractional output - the output is the fractional portion of the result; the result is
within the range <-1 ; 1). The result may overflow.
The available versions of the
Function name
Input type
Value
MLIB_ShLBi_F16
frac16_t
Freescale Semiconductor, Inc.
function is shown in the following example:
/* f16Val = -0.354 */
/* u16Sh = 8 */
Equation 47. Algorithm formula
MLIB_ShLBi
function are shown in the following table.
Table 2-49. Function versions
Result
type
Shift
int16_t
frac16_t
Bidirectional shift of a 16-bit fractional value to the left by a number
of times given by the second argument; if the second argument is
negative, the shift is performed to the right. The shift is allowed within
the range <-15 ; 15>. The output is within the range <-1 ; 1).
Table continues on the next page...
MLIB User's Guide, Rev. 2, 10/2015
Chapter 2 Algorithms in detail
Description
89

Advertisement

Table of Contents
loading

Table of Contents