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
|
Rev | Line | |
---|
[babf5d3] | 1 | /* emacs edit mode for this file is -*- C++ -*- */ |
---|
[02aaf9] | 2 | /* $Id: imm.cc,v 1.4 1998-05-11 10:52:15 schmidt Exp $ */ |
---|
[babf5d3] | 3 | |
---|
| 4 | //{{{ docu |
---|
| 5 | // |
---|
| 6 | // imm.cc - some special implementations of immediate functions |
---|
| 7 | // for some special platforms. |
---|
| 8 | // |
---|
[02aaf9] | 9 | // Hierarchy: basic, arithmetic |
---|
| 10 | // |
---|
[babf5d3] | 11 | //}}} |
---|
| 12 | |
---|
| 13 | #include <config.h> |
---|
[c41230] | 14 | |
---|
[02aaf9] | 15 | #ifdef __MWERKS__ |
---|
[c41230] | 16 | #include <stuff_64.h> |
---|
[02aaf9] | 17 | #endif |
---|
[c41230] | 18 | |
---|
[babf5d3] | 19 | #include "imm.h" |
---|
| 20 | |
---|
[02aaf9] | 21 | #ifdef __MWERKS__ |
---|
| 22 | //{{{ InternalCF * imm_mul ( InternalCF * lhs, InternalCF * rhs ) |
---|
[babf5d3] | 23 | //{{{ docu |
---|
| 24 | // |
---|
[839d2c] | 25 | // imm_mul() - multiplication of two immediate integers. |
---|
[babf5d3] | 26 | // |
---|
| 27 | // Special implementation for MetroWerks. |
---|
| 28 | // |
---|
[839d2c] | 29 | // This function has been written by Wilfred Pohl |
---|
| 30 | // <pohl@mathematik.uni-kl.de>. |
---|
| 31 | // |
---|
[babf5d3] | 32 | //}}} |
---|
| 33 | InternalCF * |
---|
[02aaf9] | 34 | imm_mul ( InternalCF * lhs, InternalCF * rhs ) |
---|
[c41230] | 35 | { |
---|
| 36 | int li = imm2int( lhs ), ri = imm2int( rhs ); |
---|
| 37 | Int_64 pr; |
---|
| 38 | |
---|
| 39 | if (li<0) |
---|
| 40 | { |
---|
[babf5d3] | 41 | if (ri<0) |
---|
| 42 | mul_64(&pr, -li, -ri); |
---|
| 43 | else |
---|
| 44 | mul_64(&pr, -li, ri); |
---|
[c41230] | 45 | } |
---|
| 46 | else |
---|
| 47 | { |
---|
[babf5d3] | 48 | if (ri<0) |
---|
| 49 | mul_64(&pr, li, -ri); |
---|
| 50 | else |
---|
| 51 | mul_64(&pr, li, ri); |
---|
[c41230] | 52 | } |
---|
[babf5d3] | 53 | |
---|
[c41230] | 54 | if (pr.hi || (pr.lo>MAXIMMEDIATE)) |
---|
| 55 | { |
---|
[babf5d3] | 56 | InternalCF * res = CFFactory::basic( IntegerDomain, li, true ); |
---|
| 57 | return res->mulcoeff( rhs ); |
---|
[c41230] | 58 | } |
---|
| 59 | else |
---|
| 60 | { |
---|
[babf5d3] | 61 | int res = pr.lo; |
---|
| 62 | if ((li>0) == (ri>0)) |
---|
| 63 | return int2imm(res); |
---|
| 64 | else |
---|
| 65 | return int2imm(-res); |
---|
| 66 | } |
---|
[c41230] | 67 | } |
---|
[babf5d3] | 68 | //}}} |
---|
[02aaf9] | 69 | #endif /* __MWERKS__ */ |
---|
Note: See
TracBrowser
for help on using the repository browser.