Re: Long long int's and sprintf

From: Daniel A. Koepke (dkoepke@circlemud.org)
Date: 06/15/01


On Fri, 15 Jun 2001, Cris Jacobin wrote:

> If my calculator serves me right 6.871948e+10 is the 36th bit. However
> 4611686018427387904 is what is saved in the file.  The first 4 bytes
> are set on but nothing above it.

You should be receiving boku warnings about the invalid conversions and
the invalid shifts on your #defines.  You want

  .
  .
  .
  #define BIT36         (1ULL << 36ULL)
  #define BIT37         (1ULL << 37ULL)
  .
  .
  .

and to use %Lu (or %llu or %qu -- your choice, %Lu is my favorite, but all
work fine).  You can do

  . . .
  #define BIT36         (1LL << 36LL)
  . . .

and use %Ld, %lld, or %qd, but it's not recommended that you make your
bitvectors signed.


--
Daniel A. Koepke (dak), dkoepke@circlemud.org
Caveat emptor: I say what I mean and mean what I say.  Listen well.
Caveat venditor: Say what you mean, mean what you say.  Say it well.

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/05/01 PST