Modify

Ticket #653 (closed Patches: fixed)

Opened 8 years ago

Last modified 4 years ago

[integer] add support for integers longer than long

Reported by: me22 Owned by: dlwalker
Milestone: Component: integer
Version: None Severity: Problem
Keywords: Cc:

Description

With the endian discussion, I looked at Boost.Integer
to try to figure out why it didn't support long long
and __int64 where possible.  Since I couldn't see a
reason why it shouldn't, I went ahead and implemented it.

The only major interface change is adding additional
ValueUpper template parameters to int_(max|min)_value_t
and uint_value_t.  They default to 0, so no valid old
code should be affected.  They allow the programmer to
use, for example, uint_value_t<0x34567890,0x12> to
request a type that can hold 0x1234567890 or
int_min_value_t<-0x34567890,-0x12> to request a type
that can hold -0x1234567890, which will properly fail
if there are no types available over 32 bits (instead
of just truncating the constant and giving the wrong
result).

I also took the opportunity to add int_exact_t
templates for cases where an exact number of bits is
needed.  int_exact_t<32>::exact, for example.  (
Ideally this would be an additional typedef inside
int_t and uint_t, but I couldn't come up with a simple
way of doing that.  If it were acceptable to have exact
as a typedef for void when not available, it'd be easy,
but that goes against existing practice. ) If this
isn't wanted, it's very easy to remove.

If this looks good I'll try to decipher the macros in
the test suite to add some new ones.  The changes don't
cause any regressions from integer_test.cpp under my
g++ 3.3.6, 3.4.6, or 4.1.1.  In keeping with the
rationale and noticing that it works just about all the
compilers, I used no partial specialisation or
recursion, so I'm hoping that it'll work fine in the
more troublesome compilers as well.  Unfortunately
portage tell me that gcc-2* is to old to work with the
rest of my system, so I haven't been able to try.

Attachments

longer_int_support.diff Download (17.0 KB) - added by dlwalker 7 years ago.
The original diff from the SourceForge? version of this ticket

Change History

comment:1 Changed 7 years ago by Niels Dekker

Please also read the discussion at the Boost User mailing list, June 2007: "[integer] Request: long long (64 bits) support for int_t and uint_t"

comment:2 Changed 7 years ago by dlwalker

  • Component changed from None to integer
  • Severity set to Problem

Changed 7 years ago by dlwalker

The original diff from the SourceForge? version of this ticket

comment:3 Changed 6 years ago by dlwalker

  • Status changed from assigned to closed
  • Resolution changed from None to fixed

(In [47414]) Added extended-integer support, which fixes #653 (the main part; the secondary part is split off as #1225)

comment:4 Changed 4 years ago by anonymous

  • Status changed from closed to reopened
  • Resolution fixed deleted

Boost.Integer has been reverted to the last known good state - these fixes are no longer in Trunk (and were never released anyway). Reopened.

comment:5 Changed 4 years ago by johnmaddock

  • Status changed from reopened to closed
  • Resolution set to fixed

(In [57873]) Add support for long long throughout. Fixes #653.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.