opal/opal — pull request #507 by chesterbr (2014-02-11 03:56:04+00:00)
Title: Making shifts with negative counts reverse the shift direction

This is very ]sane and well defined](http://www.ruby-doc.org/core-2.1.0/Fixnum.html#method-i-3C-3C) in Ruby, but JavaScript's behaviour is a bit more chaotic(*), so I introduced a comparison that "manually" reverts the direction.

New specs came from the rubyspec files with the same name for `Fixnum` (which seems to be the source for the specs that were already there). Inserted at the same position, so the files keep comparable.

(*) I found that Firefox and Chrome seem to strictly follow [ECMA-262 11.7.1](http://www.ecma-international.org/ecma-262/5.1/#sec-11.7.1) item 7, meaning they will turn negative shift counts (in two's complement) into positive - in most cases, positive numbers that are large enough to make the final result zero, regardless of the original "shifted" number.