ShiftRight Operator

Operator Library: Arithmetics

此運算子對輸入資料執行向右的算術位移。 要位移的位元數是使用參數 Shift 來定義。 輸入端的每個位元都會向右位移參數所指定的位元數。

位元位移通常用於將數值按 2 的冪次方進行縮放。 例如,向右位移一個位元會將輸入值除以 2。 向右位移 2 個位元會將輸入值除以 4。

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

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, Input BitWidth - 1] 適用於無符號數 (unsigned)

[0, Input BitWidth - 2] 適用於有符號數 (signed)

此參數定義輸入資料向右位移的位元數。

使用範例

以下範例顯示了 ShiftRight 運算子的使用方式: