[PATCH 1/4] libstdc++: Import parts of the Ryu library

Patrick Palka ppalka@redhat.com
Sun Jul 26 13:09:32 GMT 2020


On Sat, 25 Jul 2020, Václav Haisman via Libstdc++ wrote:

> On 14. 07. 20 21:41, Patrick Palka via Libstdc++ wrote:
> > This imports the source files from the Ryu library that define
> > d2s_buffered_n, f2s_buffered_n, d2fixed_buffered_n and d2exp_buffered_n
> > and generic_binary_to_decimal, which we're going to need as part of our
> > std::to_chars implementation.
> > 
> >[...]
> > diff --git a/libstdc++-v3/src/c++17/ryu/common.h b/libstdc++-v3/src/c++17/ryu/common.h
> > new file mode 100644
> > index 00000000000..7dc130947ac
> > --- /dev/null
> > +++ b/libstdc++-v3/src/c++17/ryu/common.h
> > @@ -0,0 +1,114 @@
> > +// Copyright 2018 Ulf Adams
> > +//
> > +// The contents of this file may be used under the terms of the Apache License,
> > +// Version 2.0.
> > +//
> > +//    (See accompanying file LICENSE-Apache or copy at
> > +//     http://www.apache.org/licenses/LICENSE-2.0)
> > +//
> > +// Alternatively, the contents of this file may be used under the terms of
> > +// the Boost Software License, Version 1.0.
> > +//    (See accompanying file LICENSE-Boost or copy at
> > +//     https://www.boost.org/LICENSE_1_0.txt)
> > +//
> > +// Unless required by applicable law or agreed to in writing, this software
> > +// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> > +// KIND, either express or implied.
> > +#ifndef RYU_COMMON_H
> > +#define RYU_COMMON_H
> 
> Shouldn't these be renamed to not infringe on user's macros namespaces?

It's not necessary because these Ryu bits will be used only by
floating_to_chars.cc, which is where we define these to_chars overloads
completely out-of-line.  So users won't ever see the Ryu bits.

> 
> > +
> > +#include <assert.h>
> > +#include <stdint.h>
> > +#include <string.h>
> > +
> > +#if defined(_M_IX86) || defined(_M_ARM)
> > +#define RYU_32_BIT_PLATFORM
> 
> Ditto?
> 
> > +#endif
> >[...]
> 
> -- 
> VH
> 
> 


More information about the Libstdc++ mailing list