All of lore.kernel.org
 help / color / mirror / Atom feed
From: Josh Durgin <josh.durgin@inktank.com>
To: Alex Elder <elder@inktank.com>
Cc: ceph-devel@vger.kernel.org
Subject: Re: [PATCH 1/2] libceph: add signed type limits
Date: Mon, 22 Apr 2013 15:55:59 -0700	[thread overview]
Message-ID: <5175BFFF.5090303@inktank.com> (raw)
In-Reply-To: <517456CA.7040408@inktank.com>

Reviewed-by: Josh Durgin <josh.durgin@inktank.com>

On 04/21/2013 02:14 PM, Alex Elder wrote:
> (Sorry, the subject line didn't match the content.
> Please ignore the previous one--this is the right
> patch.)
>
>
> Flesh out the limits defined in <linux/ceph/decode.h> to include the
> maximum and minimum values for signed type S8, S16, S32, and S64.
>
> Signed-off-by: Alex Elder <elder@inktank.com>
> ---
>   include/linux/ceph/decode.h |   18 ++++++++++++++----
>   1 file changed, 14 insertions(+), 4 deletions(-)
>
> diff --git a/include/linux/ceph/decode.h b/include/linux/ceph/decode.h
> index 689f1df..9575a52 100644
> --- a/include/linux/ceph/decode.h
> +++ b/include/linux/ceph/decode.h
> @@ -10,10 +10,20 @@
>
>   /* This seemed to be the easiest place to define these */
>
> -#define	U8_MAX	((u8)  (~0U))
> -#define	U16_MAX	((u16) (~0U))
> -#define	U32_MAX	((u32) (~0U))
> -#define	U64_MAX	((u64) (~0ULL))
> +#define	U8_MAX	((u8)(~0U))
> +#define	U16_MAX	((u16)(~0U))
> +#define	U32_MAX	((u32)(~0U))
> +#define	U64_MAX	((u64)(~0ULL))
> +
> +#define	S8_MAX	((s8)(U8_MAX >> 1))
> +#define	S16_MAX	((s16)(U16_MAX >> 1))
> +#define	S32_MAX	((s32)(U32_MAX >> 1))
> +#define	S64_MAX	((s64)(U64_MAX >> 1LL))
> +
> +#define	S8_MIN	((s8)(-S8_MAX - 1))
> +#define	S16_MIN	((s16)(-S16_MAX - 1))
> +#define	S32_MIN	((s32)(-S32_MAX - 1))
> +#define	S64_MIN	((s64)(-S64_MAX - 1LL))
>
>   /*
>    * in all cases,
>


  reply	other threads:[~2013-04-22 22:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-21 21:12 [PATCH 0/2] libceph: odds and ends Alex Elder
2013-04-21 21:12 ` [PATCH 1/2] libceph: add signed type limits Alex Elder
2013-04-21 21:14   ` Alex Elder
2013-04-22 22:55     ` Josh Durgin [this message]
2013-04-21 21:15 ` [PATCH 2/2] libceph: validate timespec conversions Alex Elder
2013-04-22 15:00   ` Matt W. Benjamin
2013-04-22 16:08     ` Sage Weil
2013-04-22 16:12       ` Matt W. Benjamin
2013-04-22 16:22         ` Sage Weil
2013-04-22 16:25         ` Alex Elder
2013-04-22 22:57   ` Josh Durgin

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=5175BFFF.5090303@inktank.com \
    --to=josh.durgin@inktank.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=elder@inktank.com \
    /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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.