Skip to content

ShiftBits

Discussion

Computes the arithmetic or logical shift of a multichannel signal. Shift mode is selectable through the MODE argument at design time. 0 for arithmetic shift and 1 for logical shift. The module supports fractional, and integer signals. numBits specifies the number of bit(between -31 and +31) positions to be shifted. If numBits is positive, left shift will be performed. If numBits is negative, right shift will be performed. Values outside of the allowable range are clipped. Negative values are sign extended when shifted left.

Module Pack

Standard

ClassID

classID = 254

Type Definition

typedef struct _ModuleShiftBits
{
ModuleInstanceDescriptor instance;            // Common Audio Weaver module instance structure
INT32 numBits;                                // Integer value that specifies the number of bits to shift the input.
INT32 shiftMode;                              // Shift mode either arithmetic or logical.
} ModuleShiftBitsClass;

Variables

Properties

Name Type Usage isHidden Default Value Range Units
numBits int parameter 0 0 -31:31
shiftMode int const 1 0 Unrestricted

Pins

Input Pins

Name in
Description Input signal
Data type {int, fract32}
Channel range Unrestricted
Block size range Unrestricted
Sample rate range Unrestricted
Complex support Real

Output Pins

Name out
Description Output signal
Data Type {int, fract32}

Matlab Usage

File Name: shift_bits_module.m 
 M = shift_bits_module(NAME, MODE) 
 Arithmetic or logical shift of integer or fractional data.  Arguments: 
    NAME - name of the module. 
    MODE - shift mode of either arithmetic or logical. Default to 
           arithmetic shift. 

 Copyright 2025.  DSP Concepts, Inc.  All Rights Reserved. 
 Author:  Madhan Gundluru 

Copyright (c) 2026 DSP Concepts, Inc.