From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-workers@zsh.org
Subject: Re: Patch for giga- and terabyte size specifiers
Date: Wed, 19 Feb 2014 20:03:42 +0000 [thread overview]
Message-ID: <20140219200342.6fd91e4f@pws-pc.ntlworld.com> (raw)
In-Reply-To: <20140219135242.47240238@pwslap01u.europe.root.pri>
On Wed, 19 Feb 2014 13:52:42 +0000
Peter Stephenson <p.stephenson@samsung.com> wrote:
> #if defined(ZSH_64_BIT_TYPE) || defined(LONG_IS_64_BIT)
> #ifdef LONG_IS_64_BIT
> #define ZLONG_CONST(x) x ## l
> #else
> #define ZLONG_CONST(x) x ## ll
> #endif
> case TT_GIGABYTES:
> scaled += ZLONG_CONST(1073741823);
> scaled /= ZLONG_CONST(1073741824);
> break;
> case TT_TERABYTES:
> scaled += ZLONG_CONST(1099511627775);
> scaled /= ZLONG_CONST(1099511627776);
> break;
> #endif
OK, how about
#if defined(ZSH_64_BIT_TYPE) || defined(LONG_IS_64_BIT)
#ifdef LONG_IS_64_BIT
#define ZLONG_CONST(x) x ## l
#else
#ifdef ZLONG_IS_LONG_LONG
#define ZLONG_CONST(x) x ## ll
#else
/*
* There's some 64-bit type, but we don't know what it is.
* We'll just cast it and hope the compiler does the right thing.
*/
#define ZLONG_CONST(x) ((zlong)x)
#endif
#else
/* We're stuck with long */
#define ZLONG_CONST(x) (x ## l)
#endif
? That seems to cover everything we can do within standard C.
pws
prev parent reply other threads:[~2014-02-19 20:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-19 13:12 Manuel Presnitz
2014-02-19 13:52 ` Peter Stephenson
2014-02-19 20:03 ` Peter Stephenson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140219200342.6fd91e4f@pws-pc.ntlworld.com \
--to=p.w.stephenson@ntlworld.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).