Boost logo

Boost :

Subject: Re: [boost] [xint] Boost.XInt formal review
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2011-03-07 11:44:21


Chad Nelson wrote:
> "Stewart, Robert" <Robert.Stewart_at_[hidden]> wrote:
>
> >> I've located two: abs and negate. [...] Both involve changes to the
> >> sign bit only, and one only sometimes needs to alter it. [...]
> >
> > You can do the same, I should think, without COW. All you
> > need is to make your algorithms less naive. The algorithms
> > can manage the sign in a separate variable and refer to an
> > existing magnitude or make a copy, as needed, unless I'm much
> > mistaken. That is a little less convenient, but should
> > obviate COW.
>
> Certainly it could be done without CoW. In an earlier iteration,
> I had a special subclass for that specific purpose, which kept a
> reference to an existing integer and a separate negate-the-sign
> Boolean. But if you work out the implementation, you'll see that
> it's essentially a poor-man's version of CoW anyway. Arguably
> less efficient, and definitely less aesthetically appealing, so
> I replaced it with a true CoW implementation.

The difference, as I see it, is that what I suggested is only used when it is needed and there is no reference counting involved. With COW, you force the reference counting on all internals code. There may be something about the algorithms I don't know, particularly since I haven't spent any time studying their code, but I think this will obviate the need for COW in the internals.

_____
Rob Stewart robert.stewart_at_[hidden]
Software Engineer, Core Software using std::disclaimer;
Susquehanna International Group, LLP http://www.sig.com

IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk