On 10/23/12, Richard Biener <richard.guent...@gmail.com> wrote:
> I wonder if for the various ways to specify precision/len there
> is a nice C++ way of moving this detail out of wide-int.  I can
> think only of one:
>
> struct WIntSpec {
>   WIntSpec (unsigned int len, unsigned int precision);
>   WIntSpec (const_tree);
>   WIntSpec (enum machine_mode);
>   unsigned int len;
>   unsigned int precision;
> };
>
> and then (sorry to pick one of the less useful functions):
>
>   inline static wide_int zero (WIntSpec)
>
> which you should be able to call like
>
>   wide_int::zero (SImode)
>   wide_int::zero (integer_type_node)
>
> and (ugly)
>
>   wide_int::zero (WIntSpec (32, 32))
>
> with C++0x wide_int::zero ({32, 32}) should be possible?  Or we
> keep the precision overload.  At least providing the WIntSpec
> abstraction allows custom ways of specifying required bits to
> not pollute wide-int itself too much.  Lawrence?

Yes, in C++11, wide_int::zero ({32, 32}) is possible using an
implicit conversion to WIntSpec from an initializer_list.  However,
at present we are limited to C++03 to enable older compilers as
boot compilers.

-- 
Lawrence Crowl

Reply via email to