Method: DataView#get_int16

Defined in:
ext/type_array/data_view.c

#get_int16(2) ⇒ Fixnum

Gets an int16 value from a given offset, using the provided endianness.

Examples

buf = ArrayBuffer.new(100)  => ArrayBuffer
view = DataView.new(buf)    =>  DataView
view.set_int16(2, 20)       =>  nil
view.get_int16(2)           =>  20

Returns:

  • (Fixnum)


304
305
306
307
308
# File 'ext/type_array/data_view.c', line 304

static VALUE rb_data_view_get_int16(int argc, VALUE *argv, VALUE obj)
{
    DataViewAget(obj);
    return INT2FIX(rb_type_array_get_int16(buf->buf, index, little_endian));
}