Use shift helper methods for JavaScript compatibility

I've updated the jpeg_data.dart file and tested with my application. JPG images encode properly after using dart2js and all seems to be working (I made a mistake at first and tried to squash the two commits just to make it look cleaner, but ended up with a log mess. Sorry about that...Should be ok though).