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