Last change
on this file since 1010 was
1010,
checked in by pooh, 18 years ago
|
- More work on long arithmetic.
|
-
Property svn:eol-style set to
native
-
Property svn:keywords set to
Author Date Id Revision
|
File size:
981 bytes
|
Line | |
---|
1 | #include "rf_integer.ih" |
---|
2 | |
---|
3 | namespace rftype |
---|
4 | { |
---|
5 | |
---|
6 | using namespace rfrt; |
---|
7 | |
---|
8 | void Integer::ctor (Integer* _to, Integer const* _from) |
---|
9 | { |
---|
10 | new(_to) Integer(*_from); |
---|
11 | } |
---|
12 | |
---|
13 | void Integer::dtor (Integer* _n) |
---|
14 | { |
---|
15 | mpz_t* p = _n->get_mpz_ptr(); |
---|
16 | mpz_clear(*p); |
---|
17 | mpz_allocator.deallocate(p); |
---|
18 | } |
---|
19 | |
---|
20 | bool Integer::eq (Integer const* _n1, Integer const* _n2) |
---|
21 | { |
---|
22 | return *_n1 == *_n2; |
---|
23 | } |
---|
24 | |
---|
25 | int Integer::compare (Integer const* _n1, Integer const* _n2) |
---|
26 | { |
---|
27 | return _n1->cmp(*_n2); |
---|
28 | } |
---|
29 | |
---|
30 | // |
---|
31 | // FIXME: Not implemented |
---|
32 | uint32_t Integer::hash (Integer const* _n) |
---|
33 | { |
---|
34 | (void)_n; |
---|
35 | return 0; |
---|
36 | } |
---|
37 | |
---|
38 | pxx::WString Integer::to_string (Integer const* _n) |
---|
39 | { |
---|
40 | return (pxx::WString)(*_n); |
---|
41 | } |
---|
42 | |
---|
43 | short_type_funcs_t Integer::funcs = { |
---|
44 | (void (*)(Term*, Term const*))(Integer::ctor), |
---|
45 | (void (*)(Term*))(Integer::dtor), |
---|
46 | (bool (*)(Term const*, Term const*))(Integer::eq), |
---|
47 | (int (*)(Term const*, Term const*))(Integer::compare), |
---|
48 | (uint32_t (*)(Term const*))(Integer::hash), |
---|
49 | (pxx::WString (*)(Term const*))(Integer::to_string) |
---|
50 | }; |
---|
51 | |
---|
52 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.