File: int128.cc

package info (click to toggle)
jellyfish 2.2.10-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 3,320 kB
  • sloc: cpp: 35,615; sh: 963; ruby: 578; makefile: 372; python: 165; perl: 36
file content (94 lines) | stat: -rw-r--r-- 4,054 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/*  This file is part of Jellyfish.

    Jellyfish is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Jellyfish is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Jellyfish.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#ifdef HAVE_INT128
#include <jellyfish/int128.hpp>

void __int128_ns::__print_bases(std::ostream& prefix, std::ostream& os,
                                unsigned __int128 x, 
                                const std::ios::fmtflags& ff) {
  if(x == 0) {
    os << "0";
    return;
  }
  if(ff & std::ios::showbase) {
    if(ff & std::ios::hex) {
      if(ff & std::ios::uppercase)
        prefix << "0X";
      else
        prefix << "0x";
    } else if(ff & std::ios::oct) {
      prefix << "0";
    }
  }
  if(ff & std::ios::hex) {
    __print_digits<16>(os, (unsigned __int128)x,
                       !(ff & std::ios::uppercase));
  } else if(ff & std::ios::oct) {
    __print_digits<8>(os, (unsigned __int128)x);
  }
}

#ifndef HAVE_NUMERIC_LIMITS128
const int std::numeric_limits<__int128>::digits;
const int std::numeric_limits<__int128>::digits10;
const bool std::numeric_limits<__int128>::is_signed;
const bool std::numeric_limits<__int128>::is_integer;
const bool std::numeric_limits<__int128>::is_exact;
const int std::numeric_limits<__int128>::radix;
const int std::numeric_limits<__int128>::min_exponent;
const int std::numeric_limits<__int128>::min_exponent10;
const int std::numeric_limits<__int128>::max_exponent;
const int std::numeric_limits<__int128>::max_exponent10;
const bool std::numeric_limits<__int128>::has_infinity;
const bool std::numeric_limits<__int128>::has_quiet_NaN;
const bool std::numeric_limits<__int128>::has_signaling_NaN;
const std::float_denorm_style std::numeric_limits<__int128>::has_denorm;
const bool std::numeric_limits<__int128>::has_denorm_loss;
const bool std::numeric_limits<__int128>::is_iec559;
const bool std::numeric_limits<__int128>::is_bounded;
const bool std::numeric_limits<__int128>::is_modulo;
const bool std::numeric_limits<__int128>::traps;
const bool std::numeric_limits<__int128>::tinyness_before;
const std::float_round_style std::numeric_limits<__int128>::round_style;

const int std::numeric_limits<unsigned __int128>::digits;
const int std::numeric_limits<unsigned __int128>::digits10;
const bool std::numeric_limits<unsigned __int128>::is_signed;
const bool std::numeric_limits<unsigned __int128>::is_integer;
const bool std::numeric_limits<unsigned __int128>::is_exact;
const int std::numeric_limits<unsigned __int128>::radix;
const int std::numeric_limits<unsigned __int128>::min_exponent;
const int std::numeric_limits<unsigned __int128>::min_exponent10;
const int std::numeric_limits<unsigned __int128>::max_exponent;
const int std::numeric_limits<unsigned __int128>::max_exponent10;
const bool std::numeric_limits<unsigned __int128>::has_infinity;
const bool std::numeric_limits<unsigned __int128>::has_quiet_NaN;
const bool std::numeric_limits<unsigned __int128>::has_signaling_NaN;
const std::float_denorm_style std::numeric_limits<unsigned __int128>::has_denorm;
const bool std::numeric_limits<unsigned __int128>::has_denorm_loss;
const bool std::numeric_limits<unsigned __int128>::is_iec559;
const bool std::numeric_limits<unsigned __int128>::is_bounded;
const bool std::numeric_limits<unsigned __int128>::is_modulo;
const bool std::numeric_limits<unsigned __int128>::traps;
const bool std::numeric_limits<unsigned __int128>::tinyness_before;
const std::float_round_style std::numeric_limits<unsigned __int128>::round_style;
#endif 
#endif