From: Dan Fitzpatrick Date: 2005-07-18T22:00:28+09:00 Subject: Bitwise Shift Porting from PHP I am trying to port the OLE Reader from PHP to read Excel files on any platform. I am stuck on the following function: function GetInt4d($data, $pos) { return ord($data[$pos]) | (ord($data[$pos+1]) << 8) | \ (ord($data[$pos+2]) << 16) | (ord($data[$pos+3]) << 24); } My ruby version is: def get_int_4_d(data, pos) (data[pos]) | ((data[pos+1]) << 8) | \ ((data[pos+2]) << 16) | ((data[pos+3]) << 24) end It works in some cases but in the example xls file I am using, when data[pos,0] is the character �, the function returns -2 in PHP and 4294967294 in Ruby. Thanks for your help. Dan