Hey Matz

I ended up writing the method a bit different,

    int = @input_stream.read_special(1,'C')

    if(int < 128)
      STDOUT.puts "READ INT: #{int}"
      return int
    else
      int = (int & 0x7f) << 7
      tmp = @input_stream.read_special(1,'C')
      if(tmp < 128)
        STDOUT.puts "READ INT: #{int}"
        return int | tmp
      else
        int = (int | (tmp & 0x7f)) << 7
        tmp = @input_stream.read_special(1,'C')
        if(tmp < 128)
          STDOUT.puts "READ INT: #{int}"
          return int | tmp
        else
          int = (int | (tmp & 0x7f)) << 8
          tmp = @input_stream.read_special(1,'C')
          int |= tmp

          #Check if the integer should be negative
          if ((int & 0x10000000) != 0)
            ## and extend the sign bit
            int |= 0xe0000000
          end
          STDOUT.puts "READ INT: #{int}"
          int
        end
      end
    end


this seems to be working fine.

-- 
Posted via http://www.ruby-forum.com/.