Module: BinUtils::Native

Defined in:
ext/bin_utils/native.c

Instance Method Summary collapse

Instance Method Details

#append_ber!(*args) ⇒ Object



1602
1603
1604
1605
1606
1607
1608
1609
# File 'ext/bin_utils/native.c', line 1602

static VALUE
rb_append_ber(int argc, VALUE* argv, VALUE self)
{
    append_args args;
    check_argc_append(argc, argv, &args, 0);
    append_var_ber(args.argc, args.argv, args.str);
    return args.str;
}

#append_ber_int16_be!Object

#append_ber_int16_le!Object

#append_ber_int24_be!Object

#append_ber_int24_le!Object

#append_ber_int32_be!Object

#append_ber_int32_le!Object

#append_ber_int8!(*args) ⇒ Object



1718
1719
1720
1721
1722
1723
1724
1725
# File 'ext/bin_utils/native.c', line 1718

static VALUE
rb_append_ber_int8(int argc, VALUE *argv, VALUE self)
{
    append_args2 args;
    check_argc_append_2(argc, argv, &args, 8, 0);
    append_var_ber(1, &args.int0, args.str);
    return append_var_int8(args.argc, args.argv, args.str);
}

#append_bersize_ber!(*args) ⇒ Object



1614
1615
1616
1617
1618
1619
1620
1621
1622
# File 'ext/bin_utils/native.c', line 1614

static VALUE
rb_append_bersize_ber(int argc, VALUE* argv, VALUE self)
{
    append_args args;
    VALUE add_str = rb_str_new(0, 0);
    check_argc_append(argc, argv, &args, 0);
    append_var_ber(args.argc, args.argv, add_str);
    return rb_append_bersize_string(self, args.str, add_str);
}

#append_bersize_int16_be!Object

#append_bersize_int16_le!Object

#append_bersize_int24_be!Object

#append_bersize_int24_le!Object

#append_bersize_int32_be!Object

#append_bersize_int32_le!Object

#append_bersize_int40_be!Object

#append_bersize_int40_le!Object

#append_bersize_int48_be!Object

#append_bersize_int48_le!Object

#append_bersize_int56_be!Object

#append_bersize_int56_le!Object

#append_bersize_int64_be!Object

#append_bersize_int64_le!Object

#append_bersize_int8!Object

#append_bersize_string!(str, add) ⇒ Object



1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
# File 'ext/bin_utils/native.c', line 1672

static VALUE
rb_append_bersize_string(VALUE self, VALUE str, VALUE add)
{
    if (!RTEST(str)) str = rb_str_new(0, 0);
    StringValue(add);
    append_ber(str, RSTRING_LEN(add));
    rb_str_cat(str, RSTRING_PTR(add), RSTRING_LEN(add));
    RB_GC_GUARD(add);
    return str;
}

#append_int16_be!(*args) ⇒ Object



559
560
561
562
563
564
565
# File 'ext/bin_utils/native.c', line 559

static VALUE
rb_append_int16_be(int argc, VALUE* argv, VALUE self)
{
    append_args args;
    check_argc_append(argc, argv, &args, 16);
    return append_var_int16_be(args.argc, args.argv, args.str);
}

#append_int16_ber_be!Object

#append_int16_ber_le!Object

#append_int16_int24_be!Object

#append_int16_int24_le!Object

#append_int16_int32_be!Object

#append_int16_int32_le!Object

#append_int16_int8_be!Object

#append_int16_int8_le!Object

#append_int16_le!(*args) ⇒ Object



313
314
315
316
317
318
319
# File 'ext/bin_utils/native.c', line 313

static VALUE
rb_append_int16_le(int argc, VALUE* argv, VALUE self)
{
    append_args args;
    check_argc_append(argc, argv, &args, 16);
    return append_var_int16_le(args.argc, args.argv, args.str);
}

#append_int24_be!(*args) ⇒ Object



641
642
643
644
645
646
647
# File 'ext/bin_utils/native.c', line 641

static VALUE
rb_append_int24_be(int argc, VALUE* argv, VALUE self)
{
    append_args args;
    check_argc_append(argc, argv, &args, 24);
    return append_var_int24_be(args.argc, args.argv, args.str);
}

#append_int24_ber_be!Object

#append_int24_ber_le!Object

#append_int24_int16_be!Object

#append_int24_int16_le!Object

#append_int24_int32_be!Object

#append_int24_int32_le!Object

#append_int24_int8_be!Object

#append_int24_int8_le!Object

#append_int24_le!(*args) ⇒ Object



395
396
397
398
399
400
401
# File 'ext/bin_utils/native.c', line 395

static VALUE
rb_append_int24_le(int argc, VALUE* argv, VALUE self)
{
    append_args args;
    check_argc_append(argc, argv, &args, 24);
    return append_var_int24_le(args.argc, args.argv, args.str);
}

#append_int32_be!(*args) ⇒ Object



725
726
727
728
729
730
731
# File 'ext/bin_utils/native.c', line 725

static VALUE
rb_append_int32_be(int argc, VALUE* argv, VALUE self)
{
    append_args args;
    check_argc_append(argc, argv, &args, 32);
    return append_var_int32_be(args.argc, args.argv, args.str);
}

#append_int32_ber_be!Object

#append_int32_ber_le!Object

#append_int32_int16_be!Object

#append_int32_int16_le!Object

#append_int32_int24_be!Object

#append_int32_int24_le!Object

#append_int32_int8_be!Object

#append_int32_int8_le!Object

#append_int32_le!(*args) ⇒ Object



479
480
481
482
483
484
485
# File 'ext/bin_utils/native.c', line 479

static VALUE
rb_append_int32_le(int argc, VALUE* argv, VALUE self)
{
    append_args args;
    check_argc_append(argc, argv, &args, 32);
    return append_var_int32_le(args.argc, args.argv, args.str);
}

#append_int32size_ber_be!(*args) ⇒ Object



1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
# File 'ext/bin_utils/native.c', line 1642

static VALUE
rb_append_int32size_ber_be(int argc, VALUE* argv, VALUE self)
{
    append_args args;
    long ss, bs;
    uint8_t *ptr;
    check_argc_append(argc, argv, &args, 0);
    rb_str_cat(args.str, zeros, 4);
    ss = RSTRING_LEN(args.str) - 4;
    bs = append_var_ber(args.argc, args.argv, args.str);
    ptr = ((uint8_t*)RSTRING_PTR(args.str)) + ss;
    ptr[3] = bs & 255;
    ptr[2] = (bs >> 8) & 255;
    ptr[1] = (bs >> 16) & 255;
    ptr[0] = (bs >> 24) & 255;
    return args.str;
}

#append_int32size_ber_le!(*args) ⇒ Object



1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
# File 'ext/bin_utils/native.c', line 1624

static VALUE
rb_append_int32size_ber_le(int argc, VALUE* argv, VALUE self)
{
    append_args args;
    long ss, bs;
    uint8_t *ptr;
    check_argc_append(argc, argv, &args, 0);
    rb_str_cat(args.str, zeros, 4);
    ss = RSTRING_LEN(args.str) - 4;
    bs = append_var_ber(args.argc, args.argv, args.str);
    ptr = ((uint8_t*)RSTRING_PTR(args.str)) + ss;
    ptr[0] = bs & 255;
    ptr[1] = (bs >> 8) & 255;
    ptr[2] = (bs >> 16) & 255;
    ptr[3] = (bs >> 24) & 255;
    return args.str;
}

#append_int32size_int16_be!Object

#append_int32size_int16_le!Object

#append_int32size_int24_be!Object

#append_int32size_int24_le!Object

#append_int32size_int32_be!Object

#append_int32size_int32_le!Object

#append_int32size_int40_be!Object

#append_int32size_int40_le!Object

#append_int32size_int48_be!Object

#append_int32size_int48_le!Object

#append_int32size_int56_be!Object

#append_int32size_int56_le!Object

#append_int32size_int64_be!Object

#append_int32size_int64_le!Object

#append_int32size_int8_be!Object

#append_int32size_int8_le!Object

#append_int32size_string_be!(str, add) ⇒ Object



1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
# File 'ext/bin_utils/native.c', line 1694

static VALUE
rb_append_int32size_string_be(VALUE self, VALUE str, VALUE add)
{
    if (!RTEST(str)) str = rb_str_new(0, 0);
    StringValue(add);
    append_int32_be(str, RSTRING_LEN(add));
    rb_str_cat(str, RSTRING_PTR(add), RSTRING_LEN(add));
    RB_GC_GUARD(add);
    return str;
}

#append_int32size_string_le!(str, add) ⇒ Object



1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
# File 'ext/bin_utils/native.c', line 1683

static VALUE
rb_append_int32size_string_le(VALUE self, VALUE str, VALUE add)
{
    if (!RTEST(str)) str = rb_str_new(0, 0);
    StringValue(add);
    append_int32_le(str, RSTRING_LEN(add));
    rb_str_cat(str, RSTRING_PTR(add), RSTRING_LEN(add));
    RB_GC_GUARD(add);
    return str;
}

#append_int40_be!(*args) ⇒ Object



1175
1176
1177
1178
1179
1180
1181
# File 'ext/bin_utils/native.c', line 1175

static VALUE
rb_append_int40_be(int argc, VALUE* argv, VALUE self)
{
    append_args args;
    check_argc_append(argc, argv, &args, 40);
    return append_var_int40_be(args.argc, args.argv, args.str);
}

#append_int40_le!(*args) ⇒ Object



815
816
817
818
819
820
821
# File 'ext/bin_utils/native.c', line 815

static VALUE
rb_append_int40_le(int argc, VALUE* argv, VALUE self)
{
    append_args args;
    check_argc_append(argc, argv, &args, 40);
    return append_var_int40_le(args.argc, args.argv, args.str);
}

#append_int48_be!(*args) ⇒ Object



1264
1265
1266
1267
1268
1269
1270
# File 'ext/bin_utils/native.c', line 1264

static VALUE
rb_append_int48_be(int argc, VALUE* argv, VALUE self)
{
    append_args args;
    check_argc_append(argc, argv, &args, 48);
    return append_var_int48_be(args.argc, args.argv, args.str);
}

#append_int48_le!(*args) ⇒ Object



904
905
906
907
908
909
910
# File 'ext/bin_utils/native.c', line 904

static VALUE
rb_append_int48_le(int argc, VALUE* argv, VALUE self)
{
    append_args args;
    check_argc_append(argc, argv, &args, 48);
    return append_var_int48_le(args.argc, args.argv, args.str);
}

#append_int56_be!(*args) ⇒ Object



1355
1356
1357
1358
1359
1360
1361
# File 'ext/bin_utils/native.c', line 1355

static VALUE
rb_append_int56_be(int argc, VALUE* argv, VALUE self)
{
    append_args args;
    check_argc_append(argc, argv, &args, 56);
    return append_var_int56_be(args.argc, args.argv, args.str);
}

#append_int56_le!(*args) ⇒ Object



995
996
997
998
999
1000
1001
# File 'ext/bin_utils/native.c', line 995

static VALUE
rb_append_int56_le(int argc, VALUE* argv, VALUE self)
{
    append_args args;
    check_argc_append(argc, argv, &args, 56);
    return append_var_int56_le(args.argc, args.argv, args.str);
}

#append_int64_be!(*args) ⇒ Object



1448
1449
1450
1451
1452
1453
1454
# File 'ext/bin_utils/native.c', line 1448

static VALUE
rb_append_int64_be(int argc, VALUE* argv, VALUE self)
{
    append_args args;
    check_argc_append(argc, argv, &args, 64);
    return append_var_int64_be(args.argc, args.argv, args.str);
}

#append_int64_le!(*args) ⇒ Object



1088
1089
1090
1091
1092
1093
1094
# File 'ext/bin_utils/native.c', line 1088

static VALUE
rb_append_int64_le(int argc, VALUE* argv, VALUE self)
{
    append_args args;
    check_argc_append(argc, argv, &args, 64);
    return append_var_int64_le(args.argc, args.argv, args.str);
}

#append_int8!(*args) ⇒ Object



231
232
233
234
235
236
237
# File 'ext/bin_utils/native.c', line 231

static VALUE
rb_append_int8(int argc, VALUE* argv, VALUE self)
{
    append_args args;
    check_argc_append(argc, argv, &args, 8);
    return append_var_int8(args.argc, args.argv, args.str);
}

#append_int8_ber!(*args) ⇒ Object

APPEND COMPLEX *



1708
1709
1710
1711
1712
1713
1714
1715
1716
# File 'ext/bin_utils/native.c', line 1708

static VALUE
rb_append_int8_ber(int argc, VALUE *argv, VALUE self)
{
    append_args2 args;
    check_argc_append_2(argc, argv, &args, 8, 0);
    append_var_int8(1, &args.int0, args.str);
    append_var_ber(args.argc, args.argv, args.str);
    return args.str;
}

#append_int8_int16_be!Object

#append_int8_int16_le!Object

#append_int8_int24_be!Object

#append_int8_int24_le!Object

#append_int8_int32_be!Object

#append_int8_int32_le!Object

#append_string!(str, add) ⇒ Object

APPEND STRING *



1662
1663
1664
1665
1666
1667
1668
1669
1670
# File 'ext/bin_utils/native.c', line 1662

static VALUE
rb_append_string(VALUE self, VALUE str, VALUE add)
{
    if (!RTEST(str)) str = rb_str_new(0, 0);
    StringValue(add);
    rb_str_cat(str, RSTRING_PTR(add), RSTRING_LEN(add));
    RB_GC_GUARD(add);
    return str;
}

#get_ber(*args) ⇒ Object



1491
1492
1493
1494
1495
# File 'ext/bin_utils/native.c', line 1491

static VALUE
rb_get_ber(int argc, VALUE *argv, VALUE self)
{
    return U642NUM(get_ber(argv[0], check_argc(argc, argv)));
}

#get_int16_be(*args) ⇒ Object



508
509
510
511
512
# File 'ext/bin_utils/native.c', line 508

static VALUE
rb_get_int16_be(int argc, VALUE *argv, VALUE self)
{
    return INT2FIX(get_int16_be(argv[0], check_argc(argc, argv)));
}

#get_int16_le(*args) ⇒ Object



262
263
264
265
266
# File 'ext/bin_utils/native.c', line 262

static VALUE
rb_get_int16_le(int argc, VALUE *argv, VALUE self)
{
    return INT2FIX(get_int16_le(argv[0], check_argc(argc, argv)));
}

#get_int24_be(*args) ⇒ Object



589
590
591
592
593
# File 'ext/bin_utils/native.c', line 589

static VALUE
rb_get_int24_be(int argc, VALUE *argv, VALUE self)
{
    return INT2FIX(get_int24_be(argv[0], check_argc(argc, argv)));
}

#get_int24_le(*args) ⇒ Object



343
344
345
346
347
# File 'ext/bin_utils/native.c', line 343

static VALUE
rb_get_int24_le(int argc, VALUE *argv, VALUE self)
{
    return INT2FIX(get_int24_le(argv[0], check_argc(argc, argv)));
}

#get_int32_be(*args) ⇒ Object



672
673
674
675
676
# File 'ext/bin_utils/native.c', line 672

static VALUE
rb_get_int32_be(int argc, VALUE *argv, VALUE self)
{
    return UINT2NUM(get_int32_be(argv[0], check_argc(argc, argv)));
}

#get_int32_le(*args) ⇒ Object



426
427
428
429
430
# File 'ext/bin_utils/native.c', line 426

static VALUE
rb_get_int32_le(int argc, VALUE *argv, VALUE self)
{
    return UINT2NUM(get_int32_le(argv[0], check_argc(argc, argv)));
}

#get_int40_be(*args) ⇒ Object



1121
1122
1123
1124
1125
# File 'ext/bin_utils/native.c', line 1121

static VALUE
rb_get_int40_be(int argc, VALUE *argv, VALUE self)
{
    return I642NUM(get_int40_be(argv[0], check_argc(argc, argv)));
}

#get_int40_le(*args) ⇒ Object



761
762
763
764
765
# File 'ext/bin_utils/native.c', line 761

static VALUE
rb_get_int40_le(int argc, VALUE *argv, VALUE self)
{
    return I642NUM(get_int40_le(argv[0], check_argc(argc, argv)));
}

#get_int48_be(*args) ⇒ Object



1209
1210
1211
1212
1213
# File 'ext/bin_utils/native.c', line 1209

static VALUE
rb_get_int48_be(int argc, VALUE *argv, VALUE self)
{
    return I642NUM(get_int48_be(argv[0], check_argc(argc, argv)));
}

#get_int48_le(*args) ⇒ Object



849
850
851
852
853
# File 'ext/bin_utils/native.c', line 849

static VALUE
rb_get_int48_le(int argc, VALUE *argv, VALUE self)
{
    return I642NUM(get_int48_le(argv[0], check_argc(argc, argv)));
}

#get_int56_be(*args) ⇒ Object



1299
1300
1301
1302
1303
# File 'ext/bin_utils/native.c', line 1299

static VALUE
rb_get_int56_be(int argc, VALUE *argv, VALUE self)
{
    return I642NUM(get_int56_be(argv[0], check_argc(argc, argv)));
}

#get_int56_le(*args) ⇒ Object



939
940
941
942
943
# File 'ext/bin_utils/native.c', line 939

static VALUE
rb_get_int56_le(int argc, VALUE *argv, VALUE self)
{
    return I642NUM(get_int56_le(argv[0], check_argc(argc, argv)));
}

#get_int64_be(*args) ⇒ Object



1391
1392
1393
1394
1395
# File 'ext/bin_utils/native.c', line 1391

static VALUE
rb_get_int64_be(int argc, VALUE *argv, VALUE self)
{
    return U642NUM(get_int64_be(argv[0], check_argc(argc, argv)));
}

#get_int64_le(*args) ⇒ Object



1031
1032
1033
1034
1035
# File 'ext/bin_utils/native.c', line 1031

static VALUE
rb_get_int64_le(int argc, VALUE *argv, VALUE self)
{
    return U642NUM(get_int64_le(argv[0], check_argc(argc, argv)));
}

#get_int8(*args) ⇒ Object



181
182
183
184
185
# File 'ext/bin_utils/native.c', line 181

static VALUE
rb_get_int8(int argc, VALUE *argv, VALUE self)
{
    return INT2FIX(get_int8(argv[0], check_argc(argc, argv)));
}

#get_sint16_be(*args) ⇒ Object



514
515
516
517
518
# File 'ext/bin_utils/native.c', line 514

static VALUE
rb_get_sint16_be(int argc, VALUE *argv, VALUE self)
{
    return INT2FIX(get_sint16_be(argv[0], check_argc(argc, argv)));
}

#get_sint16_le(*args) ⇒ Object



268
269
270
271
272
# File 'ext/bin_utils/native.c', line 268

static VALUE
rb_get_sint16_le(int argc, VALUE *argv, VALUE self)
{
    return INT2FIX(get_sint16_le(argv[0], check_argc(argc, argv)));
}

#get_sint24_be(*args) ⇒ Object



595
596
597
598
599
# File 'ext/bin_utils/native.c', line 595

static VALUE
rb_get_sint24_be(int argc, VALUE *argv, VALUE self)
{
    return INT2FIX(get_sint24_be(argv[0], check_argc(argc, argv)));
}

#get_sint24_le(*args) ⇒ Object



349
350
351
352
353
# File 'ext/bin_utils/native.c', line 349

static VALUE
rb_get_sint24_le(int argc, VALUE *argv, VALUE self)
{
    return INT2FIX(get_sint24_le(argv[0], check_argc(argc, argv)));
}

#get_sint32_be(*args) ⇒ Object



678
679
680
681
682
# File 'ext/bin_utils/native.c', line 678

static VALUE
rb_get_sint32_be(int argc, VALUE *argv, VALUE self)
{
    return INT2NUM(get_sint32_be(argv[0], check_argc(argc, argv)));
}

#get_sint32_le(*args) ⇒ Object



432
433
434
435
436
# File 'ext/bin_utils/native.c', line 432

static VALUE
rb_get_sint32_le(int argc, VALUE *argv, VALUE self)
{
    return INT2NUM(get_sint32_le(argv[0], check_argc(argc, argv)));
}

#get_sint40_be(*args) ⇒ Object



1127
1128
1129
1130
1131
# File 'ext/bin_utils/native.c', line 1127

static VALUE
rb_get_sint40_be(int argc, VALUE *argv, VALUE self)
{
    return I642NUM(get_sint40_be(argv[0], check_argc(argc, argv)));
}

#get_sint40_le(*args) ⇒ Object



767
768
769
770
771
# File 'ext/bin_utils/native.c', line 767

static VALUE
rb_get_sint40_le(int argc, VALUE *argv, VALUE self)
{
    return I642NUM(get_sint40_le(argv[0], check_argc(argc, argv)));
}

#get_sint48_be(*args) ⇒ Object



1215
1216
1217
1218
1219
# File 'ext/bin_utils/native.c', line 1215

static VALUE
rb_get_sint48_be(int argc, VALUE *argv, VALUE self)
{
    return I642NUM(get_sint48_be(argv[0], check_argc(argc, argv)));
}

#get_sint48_le(*args) ⇒ Object



855
856
857
858
859
# File 'ext/bin_utils/native.c', line 855

static VALUE
rb_get_sint48_le(int argc, VALUE *argv, VALUE self)
{
    return I642NUM(get_sint48_le(argv[0], check_argc(argc, argv)));
}

#get_sint56_be(*args) ⇒ Object



1305
1306
1307
1308
1309
# File 'ext/bin_utils/native.c', line 1305

static VALUE
rb_get_sint56_be(int argc, VALUE *argv, VALUE self)
{
    return I642NUM(get_sint56_be(argv[0], check_argc(argc, argv)));
}

#get_sint56_le(*args) ⇒ Object



945
946
947
948
949
# File 'ext/bin_utils/native.c', line 945

static VALUE
rb_get_sint56_le(int argc, VALUE *argv, VALUE self)
{
    return I642NUM(get_sint56_le(argv[0], check_argc(argc, argv)));
}

#get_sint64_be(*args) ⇒ Object



1397
1398
1399
1400
1401
# File 'ext/bin_utils/native.c', line 1397

static VALUE
rb_get_sint64_be(int argc, VALUE *argv, VALUE self)
{
    return I642NUM(get_sint64_be(argv[0], check_argc(argc, argv)));
}

#get_sint64_le(*args) ⇒ Object



1037
1038
1039
1040
1041
# File 'ext/bin_utils/native.c', line 1037

static VALUE
rb_get_sint64_le(int argc, VALUE *argv, VALUE self)
{
    return I642NUM(get_sint64_le(argv[0], check_argc(argc, argv)));
}

#get_sint8(*args) ⇒ Object



187
188
189
190
191
# File 'ext/bin_utils/native.c', line 187

static VALUE
rb_get_sint8(int argc, VALUE *argv, VALUE self)
{
    return INT2FIX(get_sint8(argv[0], check_argc(argc, argv)));
}

#slice_ber!(rstr) ⇒ Object



1508
1509
1510
1511
1512
1513
1514
1515
# File 'ext/bin_utils/native.c', line 1508

static VALUE
rb_slice_ber(VALUE self, VALUE rstr)
{
    long i = 0;
    int64_t res = slice_ber(rstr, &i);
    rb_str_drop_bytes(rstr, i+1);
    return U642NUM(res);
}

#slice_int16_be!(rstr) ⇒ Object



520
521
522
523
524
525
526
# File 'ext/bin_utils/native.c', line 520

static VALUE
rb_slice_int16_be(VALUE self, VALUE rstr)
{
    uint32_t res = get_int16_be(rstr, INT2FIX(0));
    rb_str_drop_bytes(rstr, 2);
    return INT2FIX(res);
}

#slice_int16_le!(rstr) ⇒ Object



274
275
276
277
278
279
280
# File 'ext/bin_utils/native.c', line 274

static VALUE
rb_slice_int16_le(VALUE self, VALUE rstr)
{
    uint32_t res = get_int16_le(rstr, INT2FIX(0));
    rb_str_drop_bytes(rstr, 2);
    return INT2FIX(res);
}

#slice_int24_be!(rstr) ⇒ Object



601
602
603
604
605
606
607
# File 'ext/bin_utils/native.c', line 601

static VALUE
rb_slice_int24_be(VALUE self, VALUE rstr)
{
    uint32_t res = get_int24_be(rstr, INT2FIX(0));
    rb_str_drop_bytes(rstr, 3);
    return INT2FIX(res);
}

#slice_int24_le!(rstr) ⇒ Object



355
356
357
358
359
360
361
# File 'ext/bin_utils/native.c', line 355

static VALUE
rb_slice_int24_le(VALUE self, VALUE rstr)
{
    uint32_t res = get_int24_le(rstr, INT2FIX(0));
    rb_str_drop_bytes(rstr, 3);
    return INT2FIX(res);
}

#slice_int32_be!(rstr) ⇒ Object



684
685
686
687
688
689
690
# File 'ext/bin_utils/native.c', line 684

static VALUE
rb_slice_int32_be(VALUE self, VALUE rstr)
{
    uint32_t res = get_int32_be(rstr, INT2FIX(0));
    rb_str_drop_bytes(rstr, 4);
    return UINT2NUM(res);
}

#slice_int32_le!(rstr) ⇒ Object



438
439
440
441
442
443
444
# File 'ext/bin_utils/native.c', line 438

static VALUE
rb_slice_int32_le(VALUE self, VALUE rstr)
{
    uint32_t res = get_int32_le(rstr, INT2FIX(0));
    rb_str_drop_bytes(rstr, 4);
    return UINT2NUM(res);
}

#slice_int40_be!(rstr) ⇒ Object



1133
1134
1135
1136
1137
1138
1139
# File 'ext/bin_utils/native.c', line 1133

static VALUE
rb_slice_int40_be(VALUE self, VALUE rstr)
{
    uint64_t res = get_int40_be(rstr, INT2FIX(0));
    rb_str_drop_bytes(rstr, 5);
    return I642NUM(res);
}

#slice_int40_le!(rstr) ⇒ Object



773
774
775
776
777
778
779
# File 'ext/bin_utils/native.c', line 773

static VALUE
rb_slice_int40_le(VALUE self, VALUE rstr)
{
    uint64_t res = get_int40_le(rstr, INT2FIX(0));
    rb_str_drop_bytes(rstr, 5);
    return I642NUM(res);
}

#slice_int48_be!(rstr) ⇒ Object



1221
1222
1223
1224
1225
1226
1227
# File 'ext/bin_utils/native.c', line 1221

static VALUE
rb_slice_int48_be(VALUE self, VALUE rstr)
{
    uint64_t res = get_int48_be(rstr, INT2FIX(0));
    rb_str_drop_bytes(rstr, 6);
    return I642NUM(res);
}

#slice_int48_le!(rstr) ⇒ Object



861
862
863
864
865
866
867
# File 'ext/bin_utils/native.c', line 861

static VALUE
rb_slice_int48_le(VALUE self, VALUE rstr)
{
    uint64_t res = get_int48_le(rstr, INT2FIX(0));
    rb_str_drop_bytes(rstr, 6);
    return I642NUM(res);
}

#slice_int56_be!(rstr) ⇒ Object



1311
1312
1313
1314
1315
1316
1317
# File 'ext/bin_utils/native.c', line 1311

static VALUE
rb_slice_int56_be(VALUE self, VALUE rstr)
{
    uint64_t res = get_int56_be(rstr, INT2FIX(0));
    rb_str_drop_bytes(rstr, 7);
    return I642NUM(res);
}

#slice_int56_le!(rstr) ⇒ Object



951
952
953
954
955
956
957
# File 'ext/bin_utils/native.c', line 951

static VALUE
rb_slice_int56_le(VALUE self, VALUE rstr)
{
    uint64_t res = get_int56_le(rstr, INT2FIX(0));
    rb_str_drop_bytes(rstr, 7);
    return I642NUM(res);
}

#slice_int64_be!(rstr) ⇒ Object



1403
1404
1405
1406
1407
1408
1409
# File 'ext/bin_utils/native.c', line 1403

static VALUE
rb_slice_int64_be(VALUE self, VALUE rstr)
{
    uint64_t res = get_int64_be(rstr, INT2FIX(0));
    rb_str_drop_bytes(rstr, 8);
    return U642NUM(res);
}

#slice_int64_le!(rstr) ⇒ Object



1043
1044
1045
1046
1047
1048
1049
# File 'ext/bin_utils/native.c', line 1043

static VALUE
rb_slice_int64_le(VALUE self, VALUE rstr)
{
    uint64_t res = get_int64_le(rstr, INT2FIX(0));
    rb_str_drop_bytes(rstr, 8);
    return U642NUM(res);
}

#slice_int8!(rstr) ⇒ Object



193
194
195
196
197
198
199
# File 'ext/bin_utils/native.c', line 193

static VALUE
rb_slice_int8(VALUE self, VALUE rstr)
{
    uint32_t res = get_int8(rstr, INT2FIX(0));
    rb_str_drop_bytes(rstr, 1);
    return INT2FIX(res);
}

#slice_sint16_be!(rstr) ⇒ Object



528
529
530
531
532
533
534
# File 'ext/bin_utils/native.c', line 528

static VALUE
rb_slice_sint16_be(VALUE self, VALUE rstr)
{
    int32_t res = get_sint16_be(rstr, INT2FIX(0));
    rb_str_drop_bytes(rstr, 2);
    return INT2FIX(res);
}

#slice_sint16_le!(rstr) ⇒ Object



282
283
284
285
286
287
288
# File 'ext/bin_utils/native.c', line 282

static VALUE
rb_slice_sint16_le(VALUE self, VALUE rstr)
{
    int32_t res = get_sint16_le(rstr, INT2FIX(0));
    rb_str_drop_bytes(rstr, 2);
    return INT2FIX(res);
}

#slice_sint24_be!(rstr) ⇒ Object



609
610
611
612
613
614
615
# File 'ext/bin_utils/native.c', line 609

static VALUE
rb_slice_sint24_be(VALUE self, VALUE rstr)
{
    int32_t res = get_sint24_be(rstr, INT2FIX(0));
    rb_str_drop_bytes(rstr, 3);
    return INT2FIX(res);
}

#slice_sint24_le!(rstr) ⇒ Object



363
364
365
366
367
368
369
# File 'ext/bin_utils/native.c', line 363

static VALUE
rb_slice_sint24_le(VALUE self, VALUE rstr)
{
    int32_t res = get_sint24_le(rstr, INT2FIX(0));
    rb_str_drop_bytes(rstr, 3);
    return INT2FIX(res);
}

#slice_sint32_be!(rstr) ⇒ Object



692
693
694
695
696
697
698
# File 'ext/bin_utils/native.c', line 692

static VALUE
rb_slice_sint32_be(VALUE self, VALUE rstr)
{
    int32_t res = get_sint32_be(rstr, INT2FIX(0));
    rb_str_drop_bytes(rstr, 4);
    return INT2NUM(res);
}

#slice_sint32_le!(rstr) ⇒ Object



446
447
448
449
450
451
452
# File 'ext/bin_utils/native.c', line 446

static VALUE
rb_slice_sint32_le(VALUE self, VALUE rstr)
{
    int32_t res = get_sint32_le(rstr, INT2FIX(0));
    rb_str_drop_bytes(rstr, 4);
    return INT2NUM(res);
}

#slice_sint40_be!(rstr) ⇒ Object



1141
1142
1143
1144
1145
1146
1147
# File 'ext/bin_utils/native.c', line 1141

static VALUE
rb_slice_sint40_be(VALUE self, VALUE rstr)
{
    uint64_t res = get_sint40_be(rstr, INT2FIX(0));
    rb_str_drop_bytes(rstr, 5);
    return I642NUM(res);
}

#slice_sint40_le!(rstr) ⇒ Object



781
782
783
784
785
786
787
# File 'ext/bin_utils/native.c', line 781

static VALUE
rb_slice_sint40_le(VALUE self, VALUE rstr)
{
    uint64_t res = get_sint40_le(rstr, INT2FIX(0));
    rb_str_drop_bytes(rstr, 5);
    return I642NUM(res);
}

#slice_sint48_be!(rstr) ⇒ Object



1229
1230
1231
1232
1233
1234
1235
# File 'ext/bin_utils/native.c', line 1229

static VALUE
rb_slice_sint48_be(VALUE self, VALUE rstr)
{
    uint64_t res = get_sint48_be(rstr, INT2FIX(0));
    rb_str_drop_bytes(rstr, 6);
    return I642NUM(res);
}

#slice_sint48_le!(rstr) ⇒ Object



869
870
871
872
873
874
875
# File 'ext/bin_utils/native.c', line 869

static VALUE
rb_slice_sint48_le(VALUE self, VALUE rstr)
{
    uint64_t res = get_sint48_le(rstr, INT2FIX(0));
    rb_str_drop_bytes(rstr, 6);
    return I642NUM(res);
}

#slice_sint56_be!(rstr) ⇒ Object



1319
1320
1321
1322
1323
1324
1325
# File 'ext/bin_utils/native.c', line 1319

static VALUE
rb_slice_sint56_be(VALUE self, VALUE rstr)
{
    uint64_t res = get_sint56_be(rstr, INT2FIX(0));
    rb_str_drop_bytes(rstr, 7);
    return I642NUM(res);
}

#slice_sint56_le!(rstr) ⇒ Object



959
960
961
962
963
964
965
# File 'ext/bin_utils/native.c', line 959

static VALUE
rb_slice_sint56_le(VALUE self, VALUE rstr)
{
    uint64_t res = get_sint56_le(rstr, INT2FIX(0));
    rb_str_drop_bytes(rstr, 7);
    return I642NUM(res);
}

#slice_sint64_be!(rstr) ⇒ Object



1411
1412
1413
1414
1415
1416
1417
# File 'ext/bin_utils/native.c', line 1411

static VALUE
rb_slice_sint64_be(VALUE self, VALUE rstr)
{
    uint64_t res = get_sint64_be(rstr, INT2FIX(0));
    rb_str_drop_bytes(rstr, 8);
    return I642NUM(res);
}

#slice_sint64_le!(rstr) ⇒ Object



1051
1052
1053
1054
1055
1056
1057
# File 'ext/bin_utils/native.c', line 1051

static VALUE
rb_slice_sint64_le(VALUE self, VALUE rstr)
{
    uint64_t res = get_sint64_le(rstr, INT2FIX(0));
    rb_str_drop_bytes(rstr, 8);
    return I642NUM(res);
}

#slice_sint8!(rstr) ⇒ Object



201
202
203
204
205
206
207
# File 'ext/bin_utils/native.c', line 201

static VALUE
rb_slice_sint8(VALUE self, VALUE rstr)
{
    int32_t res = get_sint8(rstr, INT2FIX(0));
    rb_str_drop_bytes(rstr, 1);
    return INT2FIX(res);
}