336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
|
- (instancetype)initWithSerialization: (OFXMLElement *)element
{
self = [super init];
@try {
void *pool = objc_autoreleasePoolPush();
union {
double d;
uint64_t u;
} d;
if (![element.name isEqual: self.className] ||
![element.namespace isEqual: OF_SERIALIZATION_NS])
@throw [OFInvalidArgumentException exception];
d.u = (uint64_t)element.hexadecimalValue;
d.u = OF_BSWAP64_IF_LE(d.u);
_seconds = OF_BSWAP_DOUBLE_IF_LE(d.d);
objc_autoreleasePoolPop(pool);
} @catch (id e) {
[self release];
@throw e;
}
|
<
<
<
<
<
<
|
>
|
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
|
- (instancetype)initWithSerialization: (OFXMLElement *)element
{
self = [super init];
@try {
void *pool = objc_autoreleasePoolPush();
if (![element.name isEqual: self.className] ||
![element.namespace isEqual: OF_SERIALIZATION_NS])
@throw [OFInvalidArgumentException exception];
_seconds = OF_BSWAP_DOUBLE_IF_LE(OF_INT_TO_DOUBLE_RAW(
OF_BSWAP64_IF_LE(element.hexadecimalValue)));
objc_autoreleasePoolPop(pool);
} @catch (id e) {
[self release];
@throw e;
}
|
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
|
return true;
}
- (uint32_t)hash
{
uint32_t hash;
union {
double d;
uint8_t b[sizeof(double)];
} d;
d.d = OF_BSWAP_DOUBLE_IF_BE(_seconds);
OF_HASH_INIT(hash);
for (size_t i = 0; i < sizeof(double); i++)
OF_HASH_ADD(hash, d.b[i]);
OF_HASH_FINALIZE(hash);
return hash;
}
- (id)copy
|
<
|
<
<
|
|
|
|
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
|
return true;
}
- (uint32_t)hash
{
uint32_t hash;
double tmp;
OF_HASH_INIT(hash);
tmp = OF_BSWAP_DOUBLE_IF_BE(_seconds);
for (size_t i = 0; i < sizeof(double); i++)
OF_HASH_ADD(hash, ((char *)&tmp)[i]);
OF_HASH_FINALIZE(hash);
return hash;
}
- (id)copy
|
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
|
return [self dateStringWithFormat: @"%Y-%m-%dT%H:%M:%SZ"];
}
- (OFXMLElement *)XMLElementBySerializing
{
void *pool = objc_autoreleasePoolPush();
OFXMLElement *element;
union {
double d;
uint64_t u;
} d;
element = [OFXMLElement elementWithName: self.className
namespace: OF_SERIALIZATION_NS];
d.d = OF_BSWAP_DOUBLE_IF_LE(_seconds);
element.stringValue =
[OFString stringWithFormat: @"%016" PRIx64, OF_BSWAP64_IF_LE(d.u)];
[element retain];
objc_autoreleasePoolPop(pool);
return [element autorelease];
}
|
<
<
<
<
<
|
|
>
|
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
|
return [self dateStringWithFormat: @"%Y-%m-%dT%H:%M:%SZ"];
}
- (OFXMLElement *)XMLElementBySerializing
{
void *pool = objc_autoreleasePoolPush();
OFXMLElement *element;
element = [OFXMLElement elementWithName: self.className
namespace: OF_SERIALIZATION_NS];
element.stringValue = [OFString stringWithFormat: @"%016" PRIx64,
OF_BSWAP64_IF_LE(OF_DOUBLE_TO_INT_RAW(OF_BSWAP_DOUBLE_IF_LE(
_seconds)))];
[element retain];
objc_autoreleasePoolPop(pool);
return [element autorelease];
}
|