ObjFW  Diff

Differences From Artifact [97313fd44a]:

To Artifact [4f64bc6461]:


559
560
561
562
563
564
565

566
567
568
569
570
571
572
573
574
575

576
577
578
579
580
581
582
583
584
585
586
			_value.intmax = [element decimalValue];
		} else if ([typeString isEqual: @"float"]) {
			union {
				float f;
				uint32_t u;
			} f;


			f.u = (uint32_t)[element hexadecimalValue];

			_type = OF_NUMBER_TYPE_FLOAT;
			_value.float_ = f.f;
		} else if ([typeString isEqual: @"double"]) {
			union {
				double d;
				uint64_t u;
			} d;


			d.u = (uint64_t)[element hexadecimalValue];

			_type = OF_NUMBER_TYPE_DOUBLE;
			_value.double_ = d.d;
		} else
			@throw [OFInvalidArgumentException exception];

		objc_autoreleasePoolPop(pool);
	} @catch (id e) {
		[self release];
		@throw e;







>
|


|






>
|


|







559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
			_value.intmax = [element decimalValue];
		} else if ([typeString isEqual: @"float"]) {
			union {
				float f;
				uint32_t u;
			} f;

			f.u = OF_BSWAP32_IF_LE(
			    (uint32_t)[element hexadecimalValue]);

			_type = OF_NUMBER_TYPE_FLOAT;
			_value.float_ = OF_BSWAP_FLOAT_IF_LE(f.f);
		} else if ([typeString isEqual: @"double"]) {
			union {
				double d;
				uint64_t u;
			} d;

			d.u = OF_BSWAP64_IF_LE(
			    (uint64_t)[element hexadecimalValue]);

			_type = OF_NUMBER_TYPE_DOUBLE;
			_value.double_ = OF_BSWAP_DOUBLE_IF_LE(d.d);
		} else
			@throw [OFInvalidArgumentException exception];

		objc_autoreleasePoolPop(pool);
	} @catch (id e) {
		[self release];
		@throw e;
973
974
975
976
977
978
979
980
981
982
983
984
985

986
987
988
989
990
991
992
993
994
995
996
997
998
999

1000
1001
1002
1003
1004
1005
1006
		break;
	case OF_NUMBER_TYPE_FLOAT:;
		union {
			float f;
			uint32_t u;
		} f;

		f.f = _value.float_;

		[element addAttributeWithName: @"type"
				  stringValue: @"float"];
		[element setStringValue:
		    [OFString stringWithFormat: @"%08" PRIx32, f.u]];


		break;
	case OF_NUMBER_TYPE_DOUBLE:;
		union {
			double d;
			uint64_t u;
		} d;

		d.d = _value.double_;

		[element addAttributeWithName: @"type"
				  stringValue: @"double"];
		[element setStringValue:
		    [OFString stringWithFormat: @"%016" PRIx64, d.u]];


		break;
	default:
		@throw [OFInvalidFormatException exception];
	}

	[element retain];







|




|
>








|




|
>







975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
		break;
	case OF_NUMBER_TYPE_FLOAT:;
		union {
			float f;
			uint32_t u;
		} f;

		f.f = OF_BSWAP_FLOAT_IF_LE(_value.float_);

		[element addAttributeWithName: @"type"
				  stringValue: @"float"];
		[element setStringValue:
		    [OFString stringWithFormat: @"%08" PRIx32,
						OF_BSWAP32_IF_LE(f.u)]];

		break;
	case OF_NUMBER_TYPE_DOUBLE:;
		union {
			double d;
			uint64_t u;
		} d;

		d.d = OF_BSWAP_DOUBLE_IF_LE(_value.double_);

		[element addAttributeWithName: @"type"
				  stringValue: @"double"];
		[element setStringValue:
		    [OFString stringWithFormat: @"%016" PRIx64,
						OF_BSWAP64_IF_LE(d.u)]];

		break;
	default:
		@throw [OFInvalidFormatException exception];
	}

	[element retain];