Work out bit shift instantly with clear inputs, formula shown and shareable results.
Shifting left by k multiplies by 2ᵏ and shifting right divides by 2ᵏ, discarding any remainder. Shifts were historically much faster than multiply and divide instructions, and compilers still use them.
Bit shifts
v << k = v × 2ᵏ, v >> k = floor(v / 2ᵏ)
37 × 8 = 296. In binary 100101 becomes 100101000.
For non-negative values yes, rounding toward zero. For negatives, arithmetic shift rounds toward negative infinity instead.