#elisp
Function: ash integer1 count

ash (arithmetic shift) shifts the bits in integer1 to the left count places, or to the right if count is negative.

ash gives the same results as lsh except when integer1 and count are both negative. In that case, ash puts ones in the empty bit positions on the left, while lsh puts zeros in those bit positions.

If you want to change selection, open document below and click on "Move attachment"

GNU Emacs Lisp Reference Manual: Bitwise Operations
) ; left shift ⇒ -2 In binary, the argument looks like this: ;; Decimal 536,870,911 0111...111111 (30 bits total) which becomes the following when left shifted: ;; Decimal -2 1111...111110 (30 bits total) <span>Function: ash integer1 count ash (arithmetic shift) shifts the bits in integer1 to the left count places, or to the right if count is negative. ash gives the same results as lsh except when integer1 and count are both negative. In that case, ash puts ones in the empty bit positions on the left, while lsh puts zeros in those bit positions. Thus, with ash , shifting the pattern of bits one place to the right looks like this: (ash -6 -1) ⇒ -3 ;; Decimal -6 becomes decimal -3. 1111...111010 (30 bits total) ⇒ 1111..