use double type for average

This commit is contained in:
Richard Frith-Macdonald 2018-02-06 16:59:49 +00:00
parent fcd464f118
commit c0d6599def
2 changed files with 4 additions and 3 deletions

View file

@ -10,6 +10,7 @@
* Source/NSURL.m: fix possible nul pointer dereference
* Source/NSPropertyList.m: check step before use
* Source/NSDate.m: add comment that we are ignoring non-digits
* Source/NSCache.m: use double division for calcualting averrage
2018-02-05 Richard Frith-Macdonald <rfm@gnu.org>

View file

@ -186,7 +186,7 @@
_costLimit = lim;
}
- (NSUInteger)totalCostLimit
- (NSUInteger) totalCostLimit
{
return _costLimit;
}
@ -213,7 +213,7 @@
{
NSMutableArray *evictedKeys = nil;
// Round up slightly.
NSUInteger averageAccesses = (_totalAccesses / count * 0.2) + 1;
NSUInteger averageAccesses = ((_totalAccesses / (double)count) * 0.2) + 1;
NSEnumerator *e = [_accesses objectEnumerator];
_GSCachedObject *obj;
@ -275,7 +275,7 @@
@end
@implementation _GSCachedObject
- (void)dealloc
- (void) dealloc
{
[object release];
[key release];