Implement NSDate as a small object (tagged pointer) - clang/libobjc2 only (#451)

* Implement GSSmallObject Class

* Remove private concrete class access

* Change secondary bias

* NSDate: Get interval from rhs object in comparison

* Add prefix to CONCRETE_CLASS_NAME  macro
This commit is contained in:
Hugo Melder 2024-10-28 03:52:44 -07:00 committed by GitHub
parent 1cb846e607
commit 8fd2c06ddd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 710 additions and 315 deletions

View file

@ -12,7 +12,7 @@
#ifdef EQ
#undef EQ
#endif
#define EPSILON (FLT_EPSILON*100)
#define EPSILON (DBL_EPSILON*100)
#define EQ(x,y) ((x >= y - EPSILON) && (x <= y + EPSILON))
@interface MyHandler : NSObject
@ -204,6 +204,7 @@ int main()
NSTimeInterval ot, nt;
ot = [[oa fileCreationDate] timeIntervalSinceReferenceDate];
nt = [[na fileCreationDate] timeIntervalSinceReferenceDate];
NSLog(@"ot = %f, nt = %f", ot, nt);
PASS(EQ(ot, nt), "copy creation date equals original")
ot = [[oa fileModificationDate] timeIntervalSinceReferenceDate];
nt = [[na fileModificationDate] timeIntervalSinceReferenceDate];