ObjFW  Diff

Differences From Artifact [4045525c7b]:

To Artifact [be1b948012]:


476
477
478
479
480
481
482
483

484
485

486
487
488

489
490

491
492
493
494
495
496
497
476
477
478
479
480
481
482

483
484

485
486
487

488
489

490
491
492
493
494
495
496
497







-
+

-
+


-
+

-
+







		return OFOrderedDescending;
	else
		return OFOrderedAscending;
}

- (unsigned long)hash
{
	uint32_t hash;
	unsigned long hash;

	OF_HASH_INIT(hash);
	OFHashInit(&hash);

	for (size_t i = 0; i < _count * _itemSize; i++)
		OF_HASH_ADD(hash, ((uint8_t *)_items)[i]);
		OFHashAdd(&hash, ((uint8_t *)_items)[i]);

	OF_HASH_FINALIZE(hash);
	OFHashFinalize(&hash);

	return hash;
}

- (OFData *)subdataWithRange: (OFRange)range
{
	OFData *ret;
645
646
647
648
649
650
651
652

653
654
655
656
657
658
659

660
661
662
663
664
665
666
667
668
669
670
671
672
645
646
647
648
649
650
651

652
653
654
655
656
657
658

659
660
661
662
663
664
665
666
667
668
669
670
671
672







-
+






-
+













		uint8_t tmp = (uint8_t)_count;

		data = [OFMutableData dataWithCapacity: _count + 2];
		[data addItem: &type];
		[data addItem: &tmp];
	} else if (_count <= UINT16_MAX) {
		uint8_t type = 0xC5;
		uint16_t tmp = OF_BSWAP16_IF_LE((uint16_t)_count);
		uint16_t tmp = OFToBigEndian16((uint16_t)_count);

		data = [OFMutableData dataWithCapacity: _count + 3];
		[data addItem: &type];
		[data addItems: &tmp count: sizeof(tmp)];
	} else if (_count <= UINT32_MAX) {
		uint8_t type = 0xC6;
		uint32_t tmp = OF_BSWAP32_IF_LE((uint32_t)_count);
		uint32_t tmp = OFToBigEndian32((uint32_t)_count);

		data = [OFMutableData dataWithCapacity: _count + 5];
		[data addItem: &type];
		[data addItems: &tmp count: sizeof(tmp)];
	} else
		@throw [OFOutOfRangeException exception];

	[data addItems: _items count: _count];
	[data makeImmutable];

	return data;
}
@end