mirror of https://github.com/oxen-io/session-ios
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.1 KiB
C
44 lines
1.1 KiB
C
11 years ago
|
#import <Foundation/Foundation.h>
|
||
|
#import "DataUtil.h"
|
||
|
#import "StringUtil.h"
|
||
|
#import "DictionaryUtil.h"
|
||
|
#import "ArrayUtil.h"
|
||
|
|
||
|
@interface NumberUtil : NSObject
|
||
|
|
||
|
+(int16_t) congruentDifferenceMod2ToThe16From:(uint16_t)s1 to:(uint16_t)s2;
|
||
|
|
||
|
+(int8_t) signOfInt32:(int32_t)value;
|
||
|
|
||
|
+(int8_t) signOfDouble:(double)value;
|
||
|
|
||
|
+(NSUInteger) largestIntegerThatIsAtMost:(NSUInteger)value andIsAMultipleOf:(NSUInteger)multiple;
|
||
|
|
||
|
+(NSUInteger) smallestIntegerThatIsAtLeast:(NSUInteger)value andIsAMultipleOf:(NSUInteger)multiple;
|
||
|
|
||
|
+(double) clamp:(double)value toMin:(double)min andMax:(double)max;
|
||
|
|
||
|
+(NSUInteger) from:(NSUInteger)value subtractWithSaturationAtZero:(NSUInteger)minusDelta;
|
||
|
|
||
|
+(uint8_t) uint8FromLowUInt4:(uint8_t)low4UInt4 andHighUInt4:(uint8_t)highUInt4;
|
||
|
|
||
|
+(uint8_t) lowUInt4OfUint8:(uint8_t)value;
|
||
|
|
||
|
+(uint8_t) highUInt4OfUint8:(uint8_t)value;
|
||
|
|
||
|
+(NSUInteger) assertConvertIntToNSUInteger:(int) value;
|
||
|
|
||
|
+(NSInteger) assertConvertUnsignedIntToNSInteger:(unsigned int) value;
|
||
|
|
||
|
+(int) assertConvertNSUIntegerToInt:(NSUInteger) value;
|
||
|
|
||
|
@end
|
||
|
|
||
|
@interface NSNumber (NumberUtil)
|
||
|
|
||
|
-(bool) hasUnsignedIntegerValue;
|
||
|
-(bool) hasUnsignedLongLongValue;
|
||
|
-(bool) hasLongLongValue;
|
||
|
|
||
|
@end
|