mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 00:30:53 +00:00
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:
parent
1cb846e607
commit
8fd2c06ddd
6 changed files with 710 additions and 315 deletions
41
Source/NSDatePrivate.h
Normal file
41
Source/NSDatePrivate.h
Normal file
|
@ -0,0 +1,41 @@
|
|||
/** NSDate Private Interface
|
||||
Copyright (C) 2024 Free Software Foundation, Inc.
|
||||
|
||||
Written by: Hugo Melder <hugo@algoriddim.com>
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110 USA.
|
||||
*/
|
||||
|
||||
#import <Foundation/NSDate.h>
|
||||
|
||||
#if defined(OBJC_SMALL_OBJECT_SHIFT) && (OBJC_SMALL_OBJECT_SHIFT == 3)
|
||||
#define USE_SMALL_DATE 1
|
||||
#define DATE_CONCRETE_CLASS_NAME GSSmallDate
|
||||
#else
|
||||
#define USE_SMALL_DATE 0
|
||||
#define DATE_CONCRETE_CLASS_NAME NSGDate
|
||||
#endif
|
||||
|
||||
@interface DATE_CONCRETE_CLASS_NAME : NSDate
|
||||
#if USE_SMALL_DATE == 0
|
||||
{
|
||||
@public
|
||||
NSTimeInterval _seconds_since_ref;
|
||||
}
|
||||
#endif
|
||||
@end
|
Loading…
Add table
Add a link
Reference in a new issue