ObjFW  Check-in [916ee17654]

Overview
Comment:OFNumber: Make sure -[boolValue] is always a bool.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 916ee1765408561d0467f743f65c98edae134e6375f7182357d22c4ec42b5796
User & Date: js on 2012-10-09 14:59:47
Other Links: manifest | tags
Context
2012-10-09
15:07
Make use of instancetype. check-in: fb515e8e24 user: js tags: trunk
14:59
OFNumber: Make sure -[boolValue] is always a bool. check-in: 916ee17654 user: js tags: trunk
2012-10-08
08:12
Coding style. check-in: 9276a1c3c8 user: js tags: trunk
Changes

Modified src/OFNumber.m from [13adfb2ee6] to [ff6f294978].

788
789
790
791
792
793
794

795























































796
797
798
799
800
801
802
- (of_number_type_t)type
{
	return type;
}

- (BOOL)boolValue
{

	RETURN_AS(BOOL)























































}

- (signed char)charValue
{
	RETURN_AS(signed char)
}








>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
- (of_number_type_t)type
{
	return type;
}

- (BOOL)boolValue
{
	switch (type) {
	case OF_NUMBER_BOOL:
		return !!value.bool_;
	case OF_NUMBER_CHAR:
		return !!value.char_;
	case OF_NUMBER_SHORT:
		return !!value.short_;
	case OF_NUMBER_INT:
		return !!value.int_;
	case OF_NUMBER_LONG:
		return !!value.long_;
	case OF_NUMBER_UCHAR:
		return !!value.uchar;
	case OF_NUMBER_USHORT:
		return !!value.ushort;
	case OF_NUMBER_UINT:
		return !!value.uint;
	case OF_NUMBER_ULONG:
		return !!value.ulong;
	case OF_NUMBER_INT8:
		return !!value.int8;
	case OF_NUMBER_INT16:
		return !!value.int16;
	case OF_NUMBER_INT32:
		return !!value.int32;
	case OF_NUMBER_INT64:
		return !!value.int64;
	case OF_NUMBER_UINT8:
		return !!value.uint8;
	case OF_NUMBER_UINT16:
		return !!value.uint16;
	case OF_NUMBER_UINT32:
		return !!value.uint32;
	case OF_NUMBER_UINT64:
		return !!value.uint64;
	case OF_NUMBER_SIZE:
		return !!value.size;
	case OF_NUMBER_SSIZE:
		return !!value.ssize;
	case OF_NUMBER_INTMAX:
		return !!value.intmax;
	case OF_NUMBER_UINTMAX:
		return !!value.uintmax;
	case OF_NUMBER_PTRDIFF:
		return !!value.ptrdiff;
	case OF_NUMBER_INTPTR:
		return !!value.intptr;
	case OF_NUMBER_UINTPTR:
		return !!value.uintptr;
	case OF_NUMBER_FLOAT:
		return !!value.float_;
	case OF_NUMBER_DOUBLE:
		return !!value.double_;
	default:
		@throw [OFInvalidFormatException
		    exceptionWithClass: [self class]];
	}
}

- (signed char)charValue
{
	RETURN_AS(signed char)
}