Last change
on this file since 1035 was
1035,
checked in by pooh, 18 years ago
|
- Finished library changes for long arithmetic.
|
-
Property svn:eol-style set to
native
-
Property svn:keywords set to
Author Date Id Revision
|
File size:
684 bytes
|
Line | |
---|
1 | // $Source$ |
---|
2 | // $Revision: 1035 $ |
---|
3 | // $Date: 2003-07-18 06:43:34 +0000 (Fri, 18 Jul 2003) $ |
---|
4 | // $Author: pooh $ |
---|
5 | |
---|
6 | #include <rf_core.hh> |
---|
7 | #include <rf_short_int.hh> |
---|
8 | #include <rf_integer.ih> |
---|
9 | #include <inttypes.h> |
---|
10 | #include <gmp.h> |
---|
11 | |
---|
12 | namespace refal |
---|
13 | { |
---|
14 | |
---|
15 | using namespace rfrt; |
---|
16 | using namespace rftype; |
---|
17 | |
---|
18 | namespace Arithm |
---|
19 | { |
---|
20 | |
---|
21 | RF_FUNC (Neg, (RF_ARG s_Int1), (RF_RES s_Res)) |
---|
22 | |
---|
23 | Term* p_Int1 = s_Int1.get_first(); |
---|
24 | |
---|
25 | if (p_Int1->get_type() == type_short_int) { |
---|
26 | intptr_t i1 = static_cast<ShortInt*>(p_Int1)->to_int(); |
---|
27 | s_Res = ShortInt::create_expr(-i1); |
---|
28 | } else if (p_Int1->get_type() == type_int) { |
---|
29 | Integer* i1 = static_cast<Integer*>(p_Int1); |
---|
30 | s_Res = Integer::create_expr(-(*i1)); |
---|
31 | } else { |
---|
32 | RF_LIB_ERROR("Invalid argument"); |
---|
33 | } |
---|
34 | RF_END |
---|
35 | } |
---|
36 | |
---|
37 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.