ObjFW  Check-in [b507c330f5]

Overview
Comment:Fix float*/uint32_t* casts forgotten in the last commit.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: b507c330f5442a61b45c99bf5dc409d6ec0bc49723a5f92b7947f146609802af
User & Date: js on 2011-06-06 13:34:49
Other Links: manifest | tags
Context
2011-06-06
15:53
Add missing imports to make gcc from trunk happy. check-in: df329a38cd user: js tags: trunk
13:34
Fix float*/uint32_t* casts forgotten in the last commit. check-in: b507c330f5 user: js tags: trunk
03:19
Always use unions to access a float as a uint32_t. check-in: 4b8e8836c8 user: js tags: trunk
Changes

Modified src/OFNumber.m from [c6a0bb638e] to [b1a8643b2f].

743
744
745
746
747
748
749





750
751
752

753





754
755
756

757
758
759
760
761
762
763
			 */
			type = OF_NUMBER_UINTMAX;
			value.uintmax = [[element stringValue] decimalValue];
		} else if ([typeString isEqual: @"signed"]) {
			type = OF_NUMBER_INTMAX;
			value.intmax = [[element stringValue] decimalValue];
		} else if ([typeString isEqual: @"float"]) {





			type = OF_NUMBER_FLOAT;
			*(uint32_t*)&value.float_ =
			    (uint32_t)[[element stringValue] hexadecimalValue];

		} else if ([typeString isEqual: @"double"]) {





			type = OF_NUMBER_DOUBLE;
			*(uint64_t*)&value.double_ =
			    (uint64_t)[[element stringValue] hexadecimalValue];

		} else
			@throw [OFInvalidArgumentException newWithClass: isa
							       selector: _cmd];

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







>
>
>
>
>

|
|
>

>
>
>
>
>

|
|
>







743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
			 */
			type = OF_NUMBER_UINTMAX;
			value.uintmax = [[element stringValue] decimalValue];
		} else if ([typeString isEqual: @"signed"]) {
			type = OF_NUMBER_INTMAX;
			value.intmax = [[element stringValue] decimalValue];
		} else if ([typeString isEqual: @"float"]) {
			union {
				float f;
				uint32_t i;
			} f;

			type = OF_NUMBER_FLOAT;
			f.i = (uint32_t)[[element stringValue]
			    hexadecimalValue];
			value.float_ = f.f;
		} else if ([typeString isEqual: @"double"]) {
			union {
				double d;
				uint64_t i;
			} d;

			type = OF_NUMBER_DOUBLE;
			d.i = (uint64_t)[[element stringValue]
			    hexadecimalValue];
			value.double_ = d.d;
		} else
			@throw [OFInvalidArgumentException newWithClass: isa
							       selector: _cmd];

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