37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
|
{
CFWInt *integer = ptr;
integer->value = va_arg(args, intmax_t);
return true;
}
static bool
equal(void *ptr1, void *ptr2)
{
CFWObject *obj2 = ptr2;
CFWInt *int1, *int2;
if (obj2->cls != cfw_int)
return false;
int1 = ptr1;
int2 = ptr2;
return (int1->value == int2->value);
}
static uint32_t
hash(void *ptr)
{
CFWInt *integer = ptr;
return (uint32_t)integer->value;
}
static void*
copy(void *ptr)
{
return cfw_ref(ptr);
}
intmax_t
cfw_int_value(CFWInt *integer)
{
return integer->value;
}
static CFWClass class = {
.name = "CFWInt",
.size = sizeof(CFWInt),
.ctor = ctor
.ctor = ctor,
.equal = equal,
.hash = hash,
.copy = copy
};
CFWClass *cfw_int = &class;
|