Mercurial > hg > CbC > CbC_gcc
comparison gcc/poly-int.h @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 84e7813d76e9 |
children |
comparison
equal
deleted
inserted
replaced
131:84e7813d76e9 | 145:1830386684a0 |
---|---|
1 /* Polynomial integer classes. | 1 /* Polynomial integer classes. |
2 Copyright (C) 2014-2018 Free Software Foundation, Inc. | 2 Copyright (C) 2014-2020 Free Software Foundation, Inc. |
3 | 3 |
4 This file is part of GCC. | 4 This file is part of GCC. |
5 | 5 |
6 GCC is free software; you can redistribute it and/or modify it under | 6 GCC is free software; you can redistribute it and/or modify it under |
7 the terms of the GNU General Public License as published by the Free | 7 the terms of the GNU General Public License as published by the Free |
27 included as selftests. */ | 27 included as selftests. */ |
28 | 28 |
29 #ifndef HAVE_POLY_INT_H | 29 #ifndef HAVE_POLY_INT_H |
30 #define HAVE_POLY_INT_H | 30 #define HAVE_POLY_INT_H |
31 | 31 |
32 template<unsigned int N, typename T> class poly_int_pod; | 32 template<unsigned int N, typename T> struct poly_int_pod; |
33 template<unsigned int N, typename T> class poly_int; | 33 template<unsigned int N, typename T> class poly_int; |
34 | 34 |
35 /* poly_coeff_traiits<T> describes the properties of a poly_int | 35 /* poly_coeff_traiits<T> describes the properties of a poly_int |
36 coefficient type T: | 36 coefficient type T: |
37 | 37 |
333 : (void) ((RES).coeffs[I].~C (), new (&(RES).coeffs[I]) C (VALUE))) | 333 : (void) ((RES).coeffs[I].~C (), new (&(RES).coeffs[I]) C (VALUE))) |
334 | 334 |
335 /* A base POD class for polynomial integers. The polynomial has N | 335 /* A base POD class for polynomial integers. The polynomial has N |
336 coefficients of type C. */ | 336 coefficients of type C. */ |
337 template<unsigned int N, typename C> | 337 template<unsigned int N, typename C> |
338 class poly_int_pod | 338 struct poly_int_pod |
339 { | 339 { |
340 public: | 340 public: |
341 template<typename Ca> | 341 template<typename Ca> |
342 poly_int_pod &operator = (const poly_int_pod<N, Ca> &); | 342 poly_int_pod &operator = (const poly_int_pod<N, Ca> &); |
343 template<typename Ca> | 343 template<typename Ca> |
1524 inline Ca | 1524 inline Ca |
1525 constant_lower_bound (const poly_int_pod<N, Ca> &a) | 1525 constant_lower_bound (const poly_int_pod<N, Ca> &a) |
1526 { | 1526 { |
1527 gcc_checking_assert (known_ge (a, POLY_INT_TYPE (Ca) (0))); | 1527 gcc_checking_assert (known_ge (a, POLY_INT_TYPE (Ca) (0))); |
1528 return a.coeffs[0]; | 1528 return a.coeffs[0]; |
1529 } | |
1530 | |
1531 /* Return the constant lower bound of A, given that it is no less than B. */ | |
1532 | |
1533 template<unsigned int N, typename Ca, typename Cb> | |
1534 inline POLY_CONST_COEFF (Ca, Cb) | |
1535 constant_lower_bound_with_limit (const poly_int_pod<N, Ca> &a, const Cb &b) | |
1536 { | |
1537 if (known_ge (a, b)) | |
1538 return a.coeffs[0]; | |
1539 return b; | |
1540 } | |
1541 | |
1542 /* Return the constant upper bound of A, given that it is no greater | |
1543 than B. */ | |
1544 | |
1545 template<unsigned int N, typename Ca, typename Cb> | |
1546 inline POLY_CONST_COEFF (Ca, Cb) | |
1547 constant_upper_bound_with_limit (const poly_int_pod<N, Ca> &a, const Cb &b) | |
1548 { | |
1549 if (known_le (a, b)) | |
1550 return a.coeffs[0]; | |
1551 return b; | |
1529 } | 1552 } |
1530 | 1553 |
1531 /* Return a value that is known to be no greater than A and B. This | 1554 /* Return a value that is known to be no greater than A and B. This |
1532 will be the greatest lower bound for some indeterminate values but | 1555 will be the greatest lower bound for some indeterminate values but |
1533 not necessarily for all. */ | 1556 not necessarily for all. */ |