You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
剛剛查了一下C99規格書。
6.5.7 Bitwise shift operators 上寫道:
The result of E1 >> E2 is E1 right-shifted E2 bit positions. If E1 has an unsigned type
or if E1 has a signed type and a nonnegative value, the value of the result is the integral
part of the quotient of E1 divided by the quantity, 2 raised to the power E2. If E1 has a
signed type and a negative value, the resulting value is implementation-defined.
WasmVM/src/lib/core/runtime/i32_popcnt.c
Lines 10 to 17 in f702cac
#L10 這裡 value 如果使用 int32_t 型態,會使後面 #L16 運算有問題。
由於這裡 value 型態為有號數,將使用算數位移。
算術位移與邏輯位移最大的差別在於,算術位移會考慮數值的正負號。
因此這裡 value 如果為負值,將會進入死迴圈。
The text was updated successfully, but these errors were encountered: