module ReadUnpack
Public Instance Methods
read_int16_network()
click to toggle source
static VALUE rb_read_int16_network(VALUE self) { VALUE B1, B2; long byte1, byte2, res; B1 = rb_funcall(self, id_readbyte, 0); B2 = rb_funcall(self, id_readbyte, 0); byte1 = FIX2LONG(B1); byte2 = FIX2LONG(B2); res = (byte1 < 128 ? byte1 : byte1 - 256) * 256 + byte2; return LONG2FIX(res); }
read_int32_network()
click to toggle source
static VALUE rb_read_int32_network(VALUE self) { VALUE B1, B2, B3, B4; long byte1, byte2, byte3, byte4, res; B1 = rb_funcall(self, id_readbyte, 0); B2 = rb_funcall(self, id_readbyte, 0); B3 = rb_funcall(self, id_readbyte, 0); B4 = rb_funcall(self, id_readbyte, 0); byte1 = FIX2LONG(B1); byte2 = FIX2LONG(B2); byte3 = FIX2LONG(B3); byte4 = FIX2LONG(B4); res = (((byte1 < 128 ? byte1 : byte1 - 256) * 256 + byte2) * 256 + byte3) * 256 + byte4; return LONG2NUM(res); }