]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/ada/libgnat/s-bignum.adb
[Ada] Bump copyright year
[thirdparty/gcc.git] / gcc / ada / libgnat / s-bignum.adb
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- S Y S T E M . B I G N U M S --
6 -- --
7 -- B o d y --
8 -- --
9 -- Copyright (C) 2012-2020, Free Software Foundation, Inc. --
10 -- --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
17 -- --
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
19 -- additional permissions described in the GCC Runtime Library Exception, --
20 -- version 3.1, as published by the Free Software Foundation. --
21 -- --
22 -- You should have received a copy of the GNU General Public License and --
23 -- a copy of the GCC Runtime Library Exception along with this program; --
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
25 -- <http://www.gnu.org/licenses/>. --
26 -- --
27 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
29 -- --
30 ------------------------------------------------------------------------------
31
32 with System.Generic_Bignums;
33 with Ada.Unchecked_Conversion;
34
35 package body System.Bignums is
36
37 package Sec_Stack_Bignums is new
38 System.Generic_Bignums (Use_Secondary_Stack => True);
39 use Sec_Stack_Bignums;
40
41 function "+" is new Ada.Unchecked_Conversion
42 (Bignum, Sec_Stack_Bignums.Bignum);
43
44 function "-" is new Ada.Unchecked_Conversion
45 (Sec_Stack_Bignums.Bignum, Bignum);
46
47 function Big_Add (X, Y : Bignum) return Bignum is
48 (-Sec_Stack_Bignums.Big_Add (+X, +Y));
49
50 function Big_Sub (X, Y : Bignum) return Bignum is
51 (-Sec_Stack_Bignums.Big_Sub (+X, +Y));
52
53 function Big_Mul (X, Y : Bignum) return Bignum is
54 (-Sec_Stack_Bignums.Big_Mul (+X, +Y));
55
56 function Big_Div (X, Y : Bignum) return Bignum is
57 (-Sec_Stack_Bignums.Big_Div (+X, +Y));
58
59 function Big_Exp (X, Y : Bignum) return Bignum is
60 (-Sec_Stack_Bignums.Big_Exp (+X, +Y));
61
62 function Big_Mod (X, Y : Bignum) return Bignum is
63 (-Sec_Stack_Bignums.Big_Mod (+X, +Y));
64
65 function Big_Rem (X, Y : Bignum) return Bignum is
66 (-Sec_Stack_Bignums.Big_Rem (+X, +Y));
67
68 function Big_Neg (X : Bignum) return Bignum is
69 (-Sec_Stack_Bignums.Big_Neg (+X));
70
71 function Big_Abs (X : Bignum) return Bignum is
72 (-Sec_Stack_Bignums.Big_Abs (+X));
73
74 function Big_EQ (X, Y : Bignum) return Boolean is
75 (Sec_Stack_Bignums.Big_EQ (+X, +Y));
76 function Big_NE (X, Y : Bignum) return Boolean is
77 (Sec_Stack_Bignums.Big_NE (+X, +Y));
78 function Big_GE (X, Y : Bignum) return Boolean is
79 (Sec_Stack_Bignums.Big_GE (+X, +Y));
80 function Big_LE (X, Y : Bignum) return Boolean is
81 (Sec_Stack_Bignums.Big_LE (+X, +Y));
82 function Big_GT (X, Y : Bignum) return Boolean is
83 (Sec_Stack_Bignums.Big_GT (+X, +Y));
84 function Big_LT (X, Y : Bignum) return Boolean is
85 (Sec_Stack_Bignums.Big_LT (+X, +Y));
86
87 function Bignum_In_LLI_Range (X : Bignum) return Boolean is
88 (Sec_Stack_Bignums.Bignum_In_LLI_Range (+X));
89
90 function To_Bignum (X : Long_Long_Integer) return Bignum is
91 (-Sec_Stack_Bignums.To_Bignum (X));
92
93 function From_Bignum (X : Bignum) return Long_Long_Integer is
94 (Sec_Stack_Bignums.From_Bignum (+X));
95
96 end System.Bignums;