]>
git.saurik.com Git - apple/cf.git/blob - CFBigNumber.h
2 * Copyright (c) 2013 Apple Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
25 Copyright (c) 2012-2013, Apple Inc. All rights reserved.
28 #if !defined(__COREFOUNDATION_CFBIGNUMBER__)
29 #define __COREFOUNDATION_CFBIGNUMBER__ 1
31 #include <CoreFoundation/CFBase.h>
32 #include <CoreFoundation/CFNumber.h>
35 // Base 1 billion number: each digit represents 0 to 999999999
42 void _CFBigNumInitWithInt8(_CFBigNum
*r
, int8_t inNum
);
43 void _CFBigNumInitWithInt16(_CFBigNum
*r
, int16_t inNum
);
44 void _CFBigNumInitWithInt32(_CFBigNum
*r
, int32_t inNum
);
45 void _CFBigNumInitWithInt64(_CFBigNum
*r
, int64_t inNum
);
47 void _CFBigNumInitWithInt128(_CFBigNum
*r
, __int128_t inNum
);
50 void _CFBigNumInitWithUInt8(_CFBigNum
*r
, uint8_t inNum
);
51 void _CFBigNumInitWithUInt16(_CFBigNum
*r
, uint16_t inNum
);
52 void _CFBigNumInitWithUInt32(_CFBigNum
*r
, uint32_t inNum
);
53 void _CFBigNumInitWithUInt64(_CFBigNum
*r
, uint64_t inNum
);
55 void _CFBigNumInitWithUInt128(_CFBigNum
*r
, __uint128_t inNum
);
58 int8_t _CFBigNumGetInt8(const _CFBigNum
*num
);
59 int16_t _CFBigNumGetInt16(const _CFBigNum
*num
);
60 int32_t _CFBigNumGetInt32(const _CFBigNum
*num
);
61 int64_t _CFBigNumGetInt64(const _CFBigNum
*num
);
63 __int128_t
_CFBigNumGetInt128(const _CFBigNum
*num
);
66 uint8_t _CFBigNumGetUInt8(const _CFBigNum
*num
);
67 uint16_t _CFBigNumGetUInt16(const _CFBigNum
*num
);
68 uint32_t _CFBigNumGetUInt32(const _CFBigNum
*num
);
69 uint64_t _CFBigNumGetUInt64(const _CFBigNum
*num
);
71 __uint128_t
_CFBigNumGetUInt128(const _CFBigNum
*num
);
74 void _CFBigNumInitWithCFNumber(_CFBigNum
*r
, CFNumberRef input
);
75 void _CFBigNumInitWithBytes(_CFBigNum
*r
, const void *bytes
, CFNumberType type
);
76 CFNumberRef
_CFNumberCreateWithBigNum(const _CFBigNum
*input
);
79 CFComparisonResult
_CFBigNumCompare(const _CFBigNum
*a
, const _CFBigNum
*b
);
81 void _CFBigNumNeg(_CFBigNum
*r
, const _CFBigNum
*a
);
82 uint8_t _CFBigNumAdd(_CFBigNum
*r
, const _CFBigNum
*a
, const _CFBigNum
*b
);
83 uint8_t _CFBigNumSub(_CFBigNum
*r
, const _CFBigNum
*a
, const _CFBigNum
*b
);
86 void _CFBigNumToCString(const _CFBigNum
*vp
, Boolean leading_zeros
, Boolean leading_plus
, char *buffer
, size_t buflen
);
87 void _CFBigNumFromCString(_CFBigNum
*r
, const char *string
);
89 char *_CFBigNumCopyDescription(const _CFBigNum
*num
); // caller must free() returned ptr
92 #endif /* ! __COREFOUNDATION_CFBIGNUMBER__ */