Overview
Comment: | OFNumber: Handle int endianess != float endianess |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
e29e71523ef635253d48528a40999e20 |
User & Date: | js on 2017-05-14 23:33:27 |
Other Links: | manifest | tags |
Context
2017-05-14
| ||
23:37 | OFDataArray+MessagePackValue: Use memcpy() check-in: fe4ee8b458 user: js tags: trunk | |
23:33 | OFNumber: Handle int endianess != float endianess check-in: e29e71523e user: js tags: trunk | |
23:31 | OFDate: Don't use inf for -[distant{Future,Past}] check-in: 3ba1a97679 user: js tags: trunk | |
Changes
Modified src/OFNumber.m from [97313fd44a] to [4f64bc6461].
︙ | ︙ | |||
559 560 561 562 563 564 565 | _value.intmax = [element decimalValue]; } else if ([typeString isEqual: @"float"]) { union { float f; uint32_t u; } f; | > | | > | | | 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 | break; case OF_NUMBER_TYPE_FLOAT:; union { float f; uint32_t u; } f; | | | > | | > | 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]; |
︙ | ︙ |