Name
Sar -- shift bits to the right (V3.0)
Synopsis
result = Sar(a, x[, bignum])
Function
This function shifts a by x bits to the right padding the holes with the most significant bit of a. This is called an arithmetic shift. a is converted to a signed 32-bit integer variable before the shift (unless bignum is set to True).

Starting with Hollywood 9.0, there is an optional bignum argument. If this is set to True, Sar() will be able to operate on integers larger than 2^31 but keep in mind that Sar() still won't be possible to use the full 64-bit integer range because Hollywood's numeric type is a 64-bit floating point number and is thus limited to integers in the range of [-9007199254740992,9007199254740992].

Inputs
a
source value
x
number of bits to shift
bignum
optional: whether or not to use 64-bit integers (defaults to False) (V9.0)
Results
result
integer result
Example
a = Sar(-256, 3)
This returns -32.

Show TOC