spielwiese
Last change
on this file since 839d2c was
839d2c,
checked in by Jens Schmidt <schmidt@…>, 26 years ago
|
* imm.cc: doc fix
git-svn-id: file:///usr/local/Singular/svn/trunk@1683 2c84dea3-7e68-4137-9b89-c4e89433aadc
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | /* emacs edit mode for this file is -*- C++ -*- */ |
---|
2 | /* $Id: imm.cc,v 1.3 1998-05-11 10:38:23 schmidt Exp $ */ |
---|
3 | |
---|
4 | //{{{ docu |
---|
5 | // |
---|
6 | // imm.cc - some special implementations of immediate functions |
---|
7 | // for some special platforms. |
---|
8 | // |
---|
9 | //}}} |
---|
10 | |
---|
11 | #include <config.h> |
---|
12 | |
---|
13 | #include <stuff_64.h> |
---|
14 | |
---|
15 | #include "imm.h" |
---|
16 | |
---|
17 | //{{{ InternalCF * imm_mul (InternalCF * lhs, InternalCF * rhs ) |
---|
18 | //{{{ docu |
---|
19 | // |
---|
20 | // imm_mul() - multiplication of two immediate integers. |
---|
21 | // |
---|
22 | // Special implementation for MetroWerks. |
---|
23 | // |
---|
24 | // This function has been written by Wilfred Pohl |
---|
25 | // <pohl@mathematik.uni-kl.de>. |
---|
26 | // |
---|
27 | //}}} |
---|
28 | InternalCF * |
---|
29 | imm_mul (InternalCF * lhs, InternalCF * rhs ) |
---|
30 | { |
---|
31 | int li = imm2int( lhs ), ri = imm2int( rhs ); |
---|
32 | Int_64 pr; |
---|
33 | |
---|
34 | if (li<0) |
---|
35 | { |
---|
36 | if (ri<0) |
---|
37 | mul_64(&pr, -li, -ri); |
---|
38 | else |
---|
39 | mul_64(&pr, -li, ri); |
---|
40 | } |
---|
41 | else |
---|
42 | { |
---|
43 | if (ri<0) |
---|
44 | mul_64(&pr, li, -ri); |
---|
45 | else |
---|
46 | mul_64(&pr, li, ri); |
---|
47 | } |
---|
48 | |
---|
49 | if (pr.hi || (pr.lo>MAXIMMEDIATE)) |
---|
50 | { |
---|
51 | InternalCF * res = CFFactory::basic( IntegerDomain, li, true ); |
---|
52 | return res->mulcoeff( rhs ); |
---|
53 | } |
---|
54 | else |
---|
55 | { |
---|
56 | int res = pr.lo; |
---|
57 | if ((li>0) == (ri>0)) |
---|
58 | return int2imm(res); |
---|
59 | else |
---|
60 | return int2imm(-res); |
---|
61 | } |
---|
62 | } |
---|
63 | //}}} |
---|
Note: See
TracBrowser
for help on using the repository browser.