Overview
Comment: | Remove long double from OFNumber as there's no type encoding for it. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
8eb830d7c818fcb04e2b384942184277 |
User & Date: | js on 2009-04-19 23:17:17 |
Other Links: | manifest | tags |
Context
2009-04-19
| ||
23:19 | More methods for OFNumber. check-in: 1898ec5a4b user: js tags: trunk | |
23:17 | Remove long double from OFNumber as there's no type encoding for it. check-in: 8eb830d7c8 user: js tags: trunk | |
20:34 | Use isa instead of [self class]. check-in: 139591afe1 user: js tags: trunk | |
Changes
Modified src/OFNumber.h from [6453b5d17a] to [9ea1dbd0dc].
︙ | ︙ | |||
34 35 36 37 38 39 40 | OF_NUMBER_SSIZE, OF_NUMBER_INTMAX, OF_NUMBER_UINTMAX, OF_NUMBER_PTRDIFF, OF_NUMBER_INTPTR, OF_NUMBER_FLOAT, OF_NUMBER_DOUBLE, | < | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | OF_NUMBER_SSIZE, OF_NUMBER_INTMAX, OF_NUMBER_UINTMAX, OF_NUMBER_PTRDIFF, OF_NUMBER_INTPTR, OF_NUMBER_FLOAT, OF_NUMBER_DOUBLE, }; /** * The OFNumber class provides a way to store a number in an object and * manipulate it. */ @interface OFNumber: OFObject |
︙ | ︙ | |||
68 69 70 71 72 73 74 | ssize_t ssize; intmax_t intmax; uintmax_t uintmax; ptrdiff_t ptrdiff; intptr_t intptr; float float_; double double_; | < | 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | ssize_t ssize; intmax_t intmax; uintmax_t uintmax; ptrdiff_t ptrdiff; intptr_t intptr; float float_; double double_; } value; enum of_number_type type; } + numberWithChar: (char)char_; + numberWithShort: (short)short_; + numberWithInt: (int)int_; |
︙ | ︙ | |||
97 98 99 100 101 102 103 | + numberWithSSize: (ssize_t)ssize; + numberWithIntMax: (intmax_t)intmax; + numberWithUIntMax: (uintmax_t)uintmax; + numberWithPtrDiff: (ptrdiff_t)ptrdiff; + numberWithIntPtr: (intptr_t)intptr; + numberWithFloat: (float)float_; + numberWithDouble: (double)double_; | < | 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | + numberWithSSize: (ssize_t)ssize; + numberWithIntMax: (intmax_t)intmax; + numberWithUIntMax: (uintmax_t)uintmax; + numberWithPtrDiff: (ptrdiff_t)ptrdiff; + numberWithIntPtr: (intptr_t)intptr; + numberWithFloat: (float)float_; + numberWithDouble: (double)double_; - initWithChar: (char)char_; - initWithShort: (short)short_; - initWithInt: (int)int_; - initWithLong: (long)long_; - initWithUChar: (unsigned char)uchar; - initWithUShort: (unsigned short)ushort; |
︙ | ︙ | |||
123 124 125 126 127 128 129 | - initWithSSize: (ssize_t)ssize; - initWithIntMax: (intmax_t)intmax; - initWithUIntMax: (uintmax_t)uintmax; - initWithPtrDiff: (ptrdiff_t)ptrdiff; - initWithIntPtr: (intptr_t)intptr; - initWithFloat: (float)float_; - initWithDouble: (double)double_; | < | 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | - initWithSSize: (ssize_t)ssize; - initWithIntMax: (intmax_t)intmax; - initWithUIntMax: (uintmax_t)uintmax; - initWithPtrDiff: (ptrdiff_t)ptrdiff; - initWithIntPtr: (intptr_t)intptr; - initWithFloat: (float)float_; - initWithDouble: (double)double_; - (enum of_number_type)type; - (char)asChar; - (short)asShort; - (int)asInt; - (long)asLong; |
︙ | ︙ | |||
151 152 153 154 155 156 157 | - (ssize_t)asSSize; - (intmax_t)asIntMax; - (uintmax_t)asUIntMax; - (ptrdiff_t)asPtrDiff; - (intptr_t)asIntPtr; - (float)asFloat; - (double)asDouble; | < | 147 148 149 150 151 152 153 154 | - (ssize_t)asSSize; - (intmax_t)asIntMax; - (uintmax_t)asUIntMax; - (ptrdiff_t)asPtrDiff; - (intptr_t)asIntPtr; - (float)asFloat; - (double)asDouble; @end |
Modified src/OFNumber.m from [8e480899d7] to [1e5b23cc34].
︙ | ︙ | |||
60 61 62 63 64 65 66 | return (t)value.ptrdiff; \ case OF_NUMBER_INTPTR: \ return (t)value.intptr; \ case OF_NUMBER_FLOAT: \ return (t)value.float_; \ case OF_NUMBER_DOUBLE: \ return (t)value.double_; \ | < < | 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | return (t)value.ptrdiff; \ case OF_NUMBER_INTPTR: \ return (t)value.intptr; \ case OF_NUMBER_FLOAT: \ return (t)value.float_; \ case OF_NUMBER_DOUBLE: \ return (t)value.double_; \ default: \ @throw [OFInvalidFormatException newWithClass: isa]; \ return 0; /* Make gcc happy */ \ } @implementation OFNumber + numberWithChar: (char)char_ |
︙ | ︙ | |||
188 189 190 191 192 193 194 | } + numberWithDouble: (double)double_ { return [[[OFNumber alloc] initWithDouble: double_] autorelease]; } | < < < < < | 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | } + numberWithDouble: (double)double_ { return [[[OFNumber alloc] initWithDouble: double_] autorelease]; } - initWithChar: (char)char_ { if ((self = [super init])) { value.char_ = char_; type = OF_NUMBER_CHAR; } |
︙ | ︙ | |||
433 434 435 436 437 438 439 | value.double_ = double_; type = OF_NUMBER_DOUBLE; } return self; } | < < < < < < < < < < | 426 427 428 429 430 431 432 433 434 435 436 437 438 439 | value.double_ = double_; type = OF_NUMBER_DOUBLE; } return self; } - (enum of_number_type)type { return type; } - (char)asChar { |
︙ | ︙ | |||
605 606 607 608 609 610 611 | case OF_NUMBER_UINT64: case OF_NUMBER_SIZE: case OF_NUMBER_UINTMAX: case OF_NUMBER_INTPTR: return ([obj asUIntMax] == [self asUIntMax] ? YES : NO); case OF_NUMBER_FLOAT: case OF_NUMBER_DOUBLE: | < | | 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 | case OF_NUMBER_UINT64: case OF_NUMBER_SIZE: case OF_NUMBER_UINTMAX: case OF_NUMBER_INTPTR: return ([obj asUIntMax] == [self asUIntMax] ? YES : NO); case OF_NUMBER_FLOAT: case OF_NUMBER_DOUBLE: return ([obj asDouble] == [self asDouble] ? YES : NO); default: @throw [OFInvalidArgumentException newWithClass: isa andSelector: _cmd]; } } - (uint32_t)hash { return [self asUInt32]; } @end |