2 Copyright 2008 Intel Corporation
4 Use, modification and distribution are subject to the Boost Software License,
5 Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6 http://www.boost.org/LICENSE_1_0.txt).
8 #ifndef BOOST_POLYGON_GMP_OVERRIDE_HPP
9 #define BOOST_POLYGON_GMP_OVERRIDE_HPP
11 namespace boost { namespace polygon {
15 inline gmp_int(const mpq_class& input) : v_(input) {}
18 explicit inline gmp_int(long input) : v_(input) {}
19 inline gmp_int(const gmp_int& input) : v_(input.v_) {}
20 inline gmp_int& operator=(const gmp_int& that) {
24 inline gmp_int& operator=(long that) {
28 inline operator int() const {
29 std::cout << "cast\n";
30 mpz_class num = v_.get_num();
31 mpz_class den = v_.get_den();
35 inline double get_d() const {
38 inline int get_num() const {
39 return v_.get_num().get_si();
41 inline int get_den() const {
42 return v_.get_den().get_si();
44 inline bool operator==(const gmp_int& that) const {
47 inline bool operator!=(const gmp_int& that) const {
50 inline bool operator<(const gmp_int& that) const {
51 bool retval = v_ < that.v_;
54 inline bool operator<=(const gmp_int& that) const {
57 inline bool operator>(const gmp_int& that) const {
60 inline bool operator>=(const gmp_int& that) const {
63 inline gmp_int operator+(const gmp_int& b) {
64 return gmp_int((*this).v_ + b.v_);
66 inline gmp_int operator-(const gmp_int& b) {
67 return gmp_int((*this).v_ - b.v_);
69 inline gmp_int operator*(const gmp_int& b) {
70 return gmp_int((*this).v_ * b.v_);
72 inline gmp_int operator/(const gmp_int& b) {
73 return gmp_int((*this).v_ / b.v_);
75 inline gmp_int& operator+=(const gmp_int& b) {
79 inline gmp_int& operator-=(const gmp_int& b) {
83 inline gmp_int& operator*=(const gmp_int& b) {
87 inline gmp_int& operator/=(const gmp_int& b) {
91 inline gmp_int& operator++() {
95 inline gmp_int& operator--() {
99 inline gmp_int operator++(int) {
100 gmp_int retval(*this);
104 inline gmp_int operator--(int) {
105 gmp_int retval(*this);
114 struct high_precision_type<int> {
115 typedef mpq_class type;
119 int convert_high_precision_type<int>(const mpq_class& v) {
120 mpz_class num = v.get_num();
121 mpz_class den = v.get_den();