offbrand
A collection of generic, reference counted datastructures in C for C
 All Classes Files Functions Variables Typedefs Macros Groups
obint_private.h
Go to the documentation of this file.
1 
7 #ifndef OBINT_PRIVATE_H
8 #define OBINT_PRIVATE_H
9 
10 #include "../obint.h"
11 
12 /* DATA */
13 
18 struct obint_struct{
20  int8_t sign;
21  int8_t *digits;
22  uint64_t num_digits;
23 };
24 
25 
26 /* PRIVATE METHODS */
27 
36 obint * obint_create_default(uint64_t num_digits);
37 
43 ob_hash_t obint_hash(const obj *to_hash);
44 
55 int8_t obint_compare(const obj *a, const obj *b);
56 /* Arguments are obj * so that a function pointer can be used for container
57  * class sorting/search */
58 
68 int8_t obint_compare_magnitudes(const obint *a, const obint *b);
69 
77 void obint_display(const obj *to_print);
78 
86 void obint_destroy(obj *to_dealloc);
87 
97 obint * obint_add_unsigned(const obint *a, const obint *b);
98 
111 obint * obint_subtract_unsigned(const obint *a, const obint *b);
112 
124 obint * obint_multiply_unsigned(const obint *a, const obint *b);
125 
139 obint * obint_reduce(const obint *a, const obint *b, const obint *approx,
140  uint8_t quotient);
141 
151 uint64_t obint_most_sig(const obint *a);
152 
168 void obint_split(const obint *a, uint64_t i, obint **b1, obint **b0);
169 
177 void obint_shift(obint *a, uint64_t m);
178 
186 int64_t obint_magnitude(const obint *a);
187 
198 void obint_set_max_digits(uint8_t digits);
199 
200 #endif
201