CoreFW  Check-in [e72556e3d2]

Overview
Comment:Implement equal, hash and copy for int.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: e72556e3d2e59e1d41f49b0cf966a5f1e0e8c26b421a655f9803fda3250a12ec
User & Date: js on 2012-05-03 18:39:04
Other Links: manifest | tags
Context
2012-05-03
18:43
Add box. check-in: 0c81d32c3e user: js tags: trunk
18:39
Implement equal, hash and copy for int. check-in: e72556e3d2 user: js tags: trunk
2012-04-25
09:52
Update buildsys. check-in: 6cb2f18894 user: js tags: trunk
Changes

Modified src/int.c from [e4cdadbc89] to [50c635c834].

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;