ShiftLeft Operator

Operator Library: Arithmetics

此 Operator 對輸入資料執行向左的 Arithmetic 位移。 要位移的位元數是使用 Shift 參數來定義。 輸入端的每個位元都會向左位移參數指定的位元數。新插入的最低有效位元(least significant bits)其值將為零。

位元位移通常用於按 2 的冪次方來縮放數值。 例如,向左位移一個位元會使數值加倍。 向左位移 2 個位元會使輸入值變成四倍。

每個色彩元件都會分別進行位移。

I/O Properties

Property Value
Operator Type O
Input Link I, data input
Output Link O, data output

支援的 Link 格式

Link Parameter Input Link I Output Link O
Bit Width [1, 64] 無符號,[2, 64] 有符號 自動1
Arithmetic {unsigned, signed} as I
Parallelism any as I
Kernel Columns any as I
Kernel Rows any as I
Img Protocol {VALT_IMAGE2D, VALT_LINE1D, VALT_PIXEL0D} as I
Color Format any as I
Color Flavor any as I
Max. Img Width any as I
Max. Img Height any as I

1

輸出的 Bit Width 為輸入的 Bit Width 加上 Shift 參數的值。

參數

Shift
Type static parameter
Default 0
Range [0, 64 - Input BitWidth]

此參數定義了輸入向左位移的位元數。

使用範例

以下範例展示了 ShiftLeft Operator 的使用方式: