ObjFW  Check-in [011e248c30]

Overview
Comment:Fix optimization in OFDictionary / OFMutableDictionary.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 011e248c30067ec3468e518c4c36536123dfa5348594124554e8adaeb06b5f99
User & Date: js on 2009-12-05 17:19:52
Other Links: manifest | tags
Context
2009-12-05
18:12
Improve -[initWithKey:argList:]. check-in: de26b7668a user: js tags: trunk
17:19
Fix optimization in OFDictionary / OFMutableDictionary. check-in: 011e248c30 user: js tags: trunk
17:15
Improve -[initWithObjects:forKeys:]. check-in: f6e79c23b4 user: js tags: trunk
Changes

Modified src/OFDictionary.m from [0298515cc1] to [b08a848edb].

327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
						       selector: _cmd];

	hash = [key hash];

	for (i = hash & (size - 1); i < size && data[i].key != nil &&
	    ![data[i].key isEqual: key]; i++);

	if (data[i].key == nil)
		return nil;

	/* In case the last bucket is already used */
	if (i >= size)
		for (i = 0; i < size && data[i].key != nil &&
		    ![data[i].key isEqual: key]; i++);








|







327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
						       selector: _cmd];

	hash = [key hash];

	for (i = hash & (size - 1); i < size && data[i].key != nil &&
	    ![data[i].key isEqual: key]; i++);

	if (i < size && data[i].key == nil)
		return nil;

	/* In case the last bucket is already used */
	if (i >= size)
		for (i = 0; i < size && data[i].key != nil &&
		    ![data[i].key isEqual: key]; i++);

Modified src/OFMutableDictionary.m from [04854978e7] to [cb7126369e].

131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
						       selector: _cmd];

	hash = [key hash];

	for (i = hash & (size - 1); i < size && data[i].key != nil &&
	    ![data[i].key isEqual: key]; i++);

	if (data[i].key == nil)
		return self;

	/* In case the last bucket is already used */
	if (i >= size)
		for (i = 0; i < size && data[i].key != nil &&
		    ![data[i].key isEqual: key]; i++);








|







131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
						       selector: _cmd];

	hash = [key hash];

	for (i = hash & (size - 1); i < size && data[i].key != nil &&
	    ![data[i].key isEqual: key]; i++);

	if (i < size && data[i].key == nil)
		return self;

	/* In case the last bucket is already used */
	if (i >= size)
		for (i = 0; i < size && data[i].key != nil &&
		    ![data[i].key isEqual: key]; i++);