MCPcopy Create free account
hub / github.com/TheAlgorithms/Rust / arithmetic_right_shift

Function arithmetic_right_shift

src/bit_manipulation/binary_shifts.rs:131–192  ·  view source on GitHub ↗

Performs an arithmetic right shift on a number and returns the binary representation. Shifts the bits of `number` to the right by `shift_amount` positions, preserving the sign bit. For positive numbers, fills with 0s; for negative numbers, fills with 1s (sign extension). # Arguments `number` - The integer to be shifted (can be negative) `shift_amount` - The number of positions to shift (must be

(number: i32, shift_amount: i32)

Source from the content-addressed store, hash-verified

source not stored for this graph (policy: none)

Calls 2

lenMethod · 0.45
nextMethod · 0.45