Boost Integer Traits 64-bit Support

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Boost Integer Traits 64-bit Support

Wu Yinghui, Freddie
Just a quick question, does Boost integer traits classes support 64-bit
integral types? I didn't seem to be able to get the following code compile:

#include <boost/integer.hpp>
#include <boost/integer/integer_mask.hpp>
typedef typename boost::int_t<64> int_type;
typedef boost::high_bit_mask_t<63> high_bit_type;


I know that I can use boost::int64_t, but the problem is that the "64"
here is not fixed in my code. It is dependent on some other parameters,
so it could be 32 too.

Am I missing anything?

Cheers,

Freddie

--
Wu Yinghui, Freddie
Research & Development
Software Engineer

Volume Interactions Pte Ltd
1 Kim Seng Promenade, #12-01
Great World City East Tower
Singapore 237994
Tel:   +65 62226962 (Ext 216)
Fax:   +65 62226215
Email: [hidden email]
URL:   http://www.volumeinteractions.com

Important:  This message is intended for the recipient(s) addressed
above.  It contains privileged and confidential information.  If you are
not the intended recipient, please notify the sender immediately by
replying to this message and then delete it from your system.  You must
not read, copy, use, or disseminate this communication in any form.
Thank you.

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users

yhwu.vcf (800 bytes) Download Attachment
signature.asc (194 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Boost Integer Traits 64-bit Support

John Maddock
>> I know that I can use boost::int64_t, but the problem is that the
>> "64" here is not fixed in my code. It is dependent on some other
>> parameters,
>> so it could be 32 too.
>>
>> Am I missing anything?

Apparently not: looking at the code there is no provision for use of long
long when it's available.  Daryle, fancy fixing this one?

John.

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: Boost Integer Traits 64-bit Support

Daryle Walker
[Sorry that I'm very late.  I'm still not caught up.]

On 3/6/06 7:57 AM, "Wu Yinghui, Freddie" <[hidden email]>
wrote:

> Just a quick question, does Boost integer traits classes support 64-bit
> integral types? I didn't seem to be able to get the following code compile:
>
> #include <boost/integer.hpp>
> #include <boost/integer/integer_mask.hpp>
> typedef typename boost::int_t<64> int_type;
> typedef boost::high_bit_mask_t<63> high_bit_type;
>
>
> I know that I can use boost::int64_t, but the problem is that the "64"
> here is not fixed in my code. It is dependent on some other parameters,
> so it could be 32 too.
>
> Am I missing anything?

On 3/6/06 12:53 PM, "John Maddock" <[hidden email]> wrote:

> Apparently not: looking at the code there is no provision for use of long
> long when it's available.  Daryle, fancy fixing this one?

Built-in extended types beyond "(unsigned) long" are not currently
supported.  So 64-bit numbers are supported only if "long" itself is at
least 64 bits.  The rationale for limiting the types was that types from the
"int_t" template should be usable as value-based template parameters, which
weren't necessarily supported for the extended built-in integer types.  Can
extended types be used currently for value-based template parameters on any
platforms/compilers/etc.?  Should we drop that idea and only worry about
run-time compatibility?  Should we have two kinds of templates (for compile-
or run-time compatibility)?

--
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT hotmail DOT com

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: Boost Integer Traits 64-bit Support

John Maddock
In reply to this post by Wu Yinghui, Freddie
> Built-in extended types beyond "(unsigned) long" are not currently
> supported.  So 64-bit numbers are supported only if "long" itself is
> at least 64 bits.  The rationale for limiting the types was that
> types from the "int_t" template should be usable as value-based
> template parameters, which weren't necessarily supported for the
> extended built-in integer types.  Can extended types be used
> currently for value-based template parameters on any
> platforms/compilers/etc.?  Should we drop that idea and only worry
> about run-time compatibility?  Should we have two kinds of templates
> (for compile- or run-time compatibility)?

There used to be problems with MS's __int64 not being usable in compile time
situations, but I believe nowadays long long is useable pretty much
everywhere on all compilers (including recent VC++ releases).  In any case
better to fail later (because the 64-bit type is used in an unsupported
context) than to fail early due to integer traits not supporting the type.

John.

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: Boost Integer Traits 64-bit Support

Beman Dawes

"John Maddock" <[hidden email]> wrote in message
news:007001c64ac1$618c8360$82f20352@fuji...

>> Built-in extended types beyond "(unsigned) long" are not currently
>> supported.  So 64-bit numbers are supported only if "long" itself is
>> at least 64 bits.  The rationale for limiting the types was that
>> types from the "int_t" template should be usable as value-based
>> template parameters, which weren't necessarily supported for the
>> extended built-in integer types.  Can extended types be used
>> currently for value-based template parameters on any
>> platforms/compilers/etc.?  Should we drop that idea and only worry
>> about run-time compatibility?  Should we have two kinds of templates
>> (for compile- or run-time compatibility)?
>
> There used to be problems with MS's __int64 not being usable in compile
> time
> situations, but I believe nowadays long long is useable pretty much
> everywhere on all compilers (including recent VC++ releases).

Yep. I recently looked at every modern compiler Boost regressions tests are
run on, and every one supported long long. Most have been supporting it for
years. That coupled with the fact that long long (and unsigned long long) is
already standard in C and will be standard in C++0x makes it something we
should support for sure, IMO.

--Beman



_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users