mirror of git://gcc.gnu.org/git/gcc.git
locale_facets.h (__num_base::_S_scale_hex): Add.
2001-12-09 Benjamin Kosnik <bkoz@redhat.com> Philip Martin <pmartin@uklinux.net> * include/bits/locale_facets.h (__num_base::_S_scale_hex): Add. (__num_base::_S_scale_oct): Add. * src/locale.cc: Add definitions. * testsuite/27_io/istream_extractor_arith.cc (main): Call test13. * testsuite/testsuite_hooks.h: Remove duplicate VERIFY define. Co-Authored-By: Philip Martin <pmartin@uklinux.net> From-SVN: r47837
This commit is contained in:
parent
d4197a152d
commit
2a74463013
|
|
@ -1,3 +1,13 @@
|
||||||
|
2001-12-09 Benjamin Kosnik <bkoz@redhat.com>
|
||||||
|
Philip Martin <pmartin@uklinux.net>
|
||||||
|
|
||||||
|
* include/bits/locale_facets.h (__num_base::_S_scale_hex): Add.
|
||||||
|
(__num_base::_S_scale_oct): Add.
|
||||||
|
* src/locale.cc: Add definitions.
|
||||||
|
* testsuite/27_io/istream_extractor_arith.cc (main): Call test13.
|
||||||
|
|
||||||
|
* testsuite/testsuite_hooks.h: Remove duplicate VERIFY define.
|
||||||
|
|
||||||
2001-12-07 Nathan Myers <ncm@cantrip.org>
|
2001-12-07 Nathan Myers <ncm@cantrip.org>
|
||||||
Loren Rittle <ljrittle@acm.org>
|
Loren Rittle <ljrittle@acm.org>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -439,6 +439,12 @@ namespace std
|
||||||
// Construct and return valid scanf format for integer types.
|
// Construct and return valid scanf format for integer types.
|
||||||
static void
|
static void
|
||||||
_S_format_int(const ios_base& __io, char* __fptr, char __mod, char __modl);
|
_S_format_int(const ios_base& __io, char* __fptr, char __mod, char __modl);
|
||||||
|
|
||||||
|
// Used to establish gating factor for base 16 input.
|
||||||
|
static const double _S_scale_hex;
|
||||||
|
|
||||||
|
// Used to establish gating factor for base 8 input.
|
||||||
|
static const double _S_scale_oct;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename _CharT>
|
template<typename _CharT>
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@
|
||||||
#include <bits/std_cerrno.h>
|
#include <bits/std_cerrno.h>
|
||||||
#include <bits/std_clocale.h> // For localeconv
|
#include <bits/std_clocale.h> // For localeconv
|
||||||
#include <bits/std_cstdlib.h> // For strof, strtold
|
#include <bits/std_cstdlib.h> // For strof, strtold
|
||||||
#include <bits/std_cmath.h> // For ceil
|
#include <bits/std_cmath.h> // For ceil
|
||||||
#include <bits/std_limits.h> // For numeric_limits
|
#include <bits/std_limits.h> // For numeric_limits
|
||||||
#include <bits/std_memory.h> // For auto_ptr
|
#include <bits/std_memory.h> // For auto_ptr
|
||||||
#include <bits/streambuf_iterator.h> // For streambuf_iterators
|
#include <bits/streambuf_iterator.h> // For streambuf_iterators
|
||||||
|
|
@ -299,11 +299,13 @@ namespace std
|
||||||
// Figure out the maximum number of digits that can be extracted
|
// Figure out the maximum number of digits that can be extracted
|
||||||
// for the given type, using the determined base.
|
// for the given type, using the determined base.
|
||||||
int __max_digits;
|
int __max_digits;
|
||||||
if (__base != 10)
|
if (__base == 10)
|
||||||
__max_digits = static_cast<int>(ceil(__max * log(10.0)
|
|
||||||
/log(static_cast<double>(__base))));
|
|
||||||
else
|
|
||||||
__max_digits = __max;
|
__max_digits = __max;
|
||||||
|
else if (__base == 16)
|
||||||
|
__max_digits = static_cast<int>(ceil(__max * _S_scale_hex));
|
||||||
|
else if (__base == 8)
|
||||||
|
__max_digits = static_cast<int>(ceil(__max * _S_scale_oct));
|
||||||
|
|
||||||
// Add in what's already been extracted.
|
// Add in what's already been extracted.
|
||||||
__max_digits += __pos;
|
__max_digits += __pos;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,10 @@ namespace std
|
||||||
|
|
||||||
const char __num_base::_S_atoms[] = "0123456789eEabcdfABCDF";
|
const char __num_base::_S_atoms[] = "0123456789eEabcdfABCDF";
|
||||||
|
|
||||||
|
const double __num_base::_S_scale_hex = log(10.0)/log(16.0);
|
||||||
|
|
||||||
|
const double __num_base::_S_scale_oct = log(10.0)/log(8.0);
|
||||||
|
|
||||||
// Definitions for static const data members of locale::_Impl
|
// Definitions for static const data members of locale::_Impl
|
||||||
const locale::id* const
|
const locale::id* const
|
||||||
locale::_Impl::_S_id_ctype[] =
|
locale::_Impl::_S_id_ctype[] =
|
||||||
|
|
|
||||||
|
|
@ -579,7 +579,7 @@ void test13()
|
||||||
digits += '1';
|
digits += '1';
|
||||||
istringstream iss2(digits);
|
istringstream iss2(digits);
|
||||||
iss2 >> i;
|
iss2 >> i;
|
||||||
VERIFY( iss2.good() );
|
VERIFY( !iss2.fail() );
|
||||||
|
|
||||||
digits += '1';
|
digits += '1';
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
@ -604,6 +604,7 @@ int main()
|
||||||
|
|
||||||
test11();
|
test11();
|
||||||
test12();
|
test12();
|
||||||
|
test13();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,6 @@
|
||||||
# define VERIFY(fn) assert(fn)
|
# define VERIFY(fn) assert(fn)
|
||||||
#else
|
#else
|
||||||
# define VERIFY(fn) test &= (fn)
|
# define VERIFY(fn) test &= (fn)
|
||||||
# define VERIFY(fn) fn
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <bits/c++config.h>
|
#include <bits/c++config.h>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue