[zeromq-dev] Question on atomic_counter

Steven McCoy steven.mccoy at miru.hk
Fri Aug 6 03:48:52 CEST 2010

On 6 August 2010 01:51, Stewart Douglas <sdouglas at snowgold.com> wrote:

> Running on a Ubuntu 64 bit on a Xeon processor , I believe the code below
> will be what executes. integer_t is a typedef for uint32_t, so the
> assignment to -decrement seems wrong to me - the zmq code is always calling
> sub with a parameter of one, to reduce the reference count by one in a
> zmq_msg_close() and pub_t::xsend().
> So am puzzled how this is working ? Should oldval be an int32_t rather than
> uint32_t ?
With finite field math, (uint8_t)-1 == (uint8_t)255, the sign is no longer
relevant as you take advantage of the wrapping around zero.

There is an entire field of math devoted to it, and forms the basis of many
DSP operations, etc.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20100806/9b428a1e/attachment.htm>

More information about the zeromq-dev mailing list