Module: Num2int

Defined in:
ext/-test-/num2int/num2int.c

Class Method Summary collapse

Class Method Details

.FIX2INT(num) ⇒ Object



77
78
79
80
81
82
83
# File 'ext/-test-/num2int/num2int.c', line 77

static VALUE
test_fix2int(VALUE obj, VALUE num)
{
    char buf[128];
    snprintf(buf, sizeof(buf), "%d", FIX2INT(num));
    return rb_str_new_cstr(buf);
}

.FIX2LONG(num) ⇒ Object



93
94
95
96
97
98
99
# File 'ext/-test-/num2int/num2int.c', line 93

static VALUE
test_fix2long(VALUE obj, VALUE num)
{
    char buf[128];
    snprintf(buf, sizeof(buf), "%ld", FIX2LONG(num));
    return rb_str_new_cstr(buf);
}

.FIX2SHORT(num) ⇒ Object



69
70
71
72
73
74
75
# File 'ext/-test-/num2int/num2int.c', line 69

static VALUE
test_fix2short(VALUE obj, VALUE num)
{
    char buf[128];
    snprintf(buf, sizeof(buf), "%d", FIX2SHORT(num));
    return rb_str_new_cstr(buf);
}

.FIX2UINT(num) ⇒ Object



85
86
87
88
89
90
91
# File 'ext/-test-/num2int/num2int.c', line 85

static VALUE
test_fix2uint(VALUE obj, VALUE num)
{
    char buf[128];
    snprintf(buf, sizeof(buf), "%u", FIX2UINT(num));
    return rb_str_new_cstr(buf);
}

.FIX2ULONG(num) ⇒ Object



101
102
103
104
105
106
107
# File 'ext/-test-/num2int/num2int.c', line 101

static VALUE
test_fix2ulong(VALUE obj, VALUE num)
{
    char buf[128];
    snprintf(buf, sizeof(buf), "%lu", FIX2ULONG(num));
    return rb_str_new_cstr(buf);
}

.NUM2INT(num) ⇒ Object



19
20
21
22
23
24
25
# File 'ext/-test-/num2int/num2int.c', line 19

static VALUE
test_num2int(VALUE obj, VALUE num)
{
    char buf[128];
    snprintf(buf, sizeof(buf), "%d", NUM2INT(num));
    return rb_str_new_cstr(buf);
}

.NUM2LL(num) ⇒ Object



52
53
54
55
56
57
58
# File 'ext/-test-/num2int/num2int.c', line 52

static VALUE
test_num2ll(VALUE obj, VALUE num)
{
    char buf[128];
    snprintf(buf, sizeof(buf), "%"PRI_LL_PREFIX"d", NUM2LL(num));
    return rb_str_new_cstr(buf);
}

.NUM2LONG(num) ⇒ Object



35
36
37
38
39
40
41
# File 'ext/-test-/num2int/num2int.c', line 35

static VALUE
test_num2long(VALUE obj, VALUE num)
{
    char buf[128];
    snprintf(buf, sizeof(buf), "%ld", NUM2LONG(num));
    return rb_str_new_cstr(buf);
}

.NUM2SHORT(num) ⇒ Object



3
4
5
6
7
8
9
# File 'ext/-test-/num2int/num2int.c', line 3

static VALUE
test_num2short(VALUE obj, VALUE num)
{
    char buf[128];
    snprintf(buf, sizeof(buf), "%d", NUM2SHORT(num));
    return rb_str_new_cstr(buf);
}

.NUM2UINT(num) ⇒ Object



27
28
29
30
31
32
33
# File 'ext/-test-/num2int/num2int.c', line 27

static VALUE
test_num2uint(VALUE obj, VALUE num)
{
    char buf[128];
    snprintf(buf, sizeof(buf), "%u", NUM2UINT(num));
    return rb_str_new_cstr(buf);
}

.NUM2ULL(num) ⇒ Object



60
61
62
63
64
65
66
# File 'ext/-test-/num2int/num2int.c', line 60

static VALUE
test_num2ull(VALUE obj, VALUE num)
{
    char buf[128];
    snprintf(buf, sizeof(buf), "%"PRI_LL_PREFIX"u", NUM2ULL(num));
    return rb_str_new_cstr(buf);
}

.NUM2ULONG(num) ⇒ Object



43
44
45
46
47
48
49
# File 'ext/-test-/num2int/num2int.c', line 43

static VALUE
test_num2ulong(VALUE obj, VALUE num)
{
    char buf[128];
    snprintf(buf, sizeof(buf), "%lu", NUM2ULONG(num));
    return rb_str_new_cstr(buf);
}

.NUM2USHORT(num) ⇒ Object



11
12
13
14
15
16
17
# File 'ext/-test-/num2int/num2int.c', line 11

static VALUE
test_num2ushort(VALUE obj, VALUE num)
{
    char buf[128];
    snprintf(buf, sizeof(buf), "%u", NUM2USHORT(num));
    return rb_str_new_cstr(buf);
}