?: operator works like this:
(condition) ? (do if condition is true) : (do if condition is false)
So, whenever $b is less than 0, that is, a negative number:
If $b = -1, then -$b = 1.
So the above translates to: shift left, when b is positive, or right, when b is negative, by the absolute value of $b.