lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Roberto Ierusalimschy wrote:
Yup ... the bit-shifting functions in Emacs-lisp are of the "only one
function with the shift-count sign determining direction" variety, and I
have to check the documentation _every_ time I use them, or when I read
code using them, to see what the "main" direction is -- even though I've
using them (occasionally) for probably decades...

It shifts to the left for positive countings, does it not? It is not
dificult to figure out, although I have never used Emacs-lisp. If you
remember that shifting is basically a multiplication by a power of 2,
it becomes quite intuitive that 1 shifts to the left and -1 shifts to
the right.

That's how my mental model of shifting works too :-)

Ralph