The bit-shift operators (<< and >>) return the value of the left argument shifted to the left (<<) or to the right (>>) by the number of bits specified by the right argument. The arguments should be integers. For example:
Be careful, though. Results on large (or negative) numbers may vary depending on the number of bits your machine uses to represent integers.1 << 4; # returns 16 32 >> 4; # returns 2
Copyright © 2002 O'Reilly & Associates. All rights reserved.