From patchwork Mon Jan 27 22:15:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 23760 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ig0-f200.google.com (mail-ig0-f200.google.com [209.85.213.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7806B20300 for ; Mon, 27 Jan 2014 22:15:37 +0000 (UTC) Received: by mail-ig0-f200.google.com with SMTP id k19sf15954008igc.3 for ; Mon, 27 Jan 2014 14:15:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:message-id:date:from:user-agent :mime-version:to:subject:references:in-reply-to:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe:content-type :content-transfer-encoding; bh=ZbSJYDUZDlPxJvFjkEdu2EwHdCPlBXd6nQgAXsrHejU=; b=NYqK2OudKwSaSV5pSxn6NZ9wY3L4fCHtWStPQoi7lZ0TyZV3hmbibTa+OLFUh+sxtQ xSfJ8ui7cnFirbtDKEW8B14tDXDQdDmS/dtqetyrwKFK7HXFBCJG6kA2+IJ2q5MYWG6S 3B8KJugQOgHZnSyPlZPSSePzJLlESCUeTqyWiDeKT/GuE56LEQqT+eVU7RKihJnAfkZL 6TK4P1SLhiNqqdeOZweENWDX1yhfmVoHobE56ccVYnz+maXEAxjOjobQjGplWnMsNGLx Pin1GsZH05l/D3lsiFJVyi6iJI7xFVT/udjKKkcuEuZfC7zQrF38LP5sz1hLubksTk1Q 1gCQ== X-Gm-Message-State: ALoCoQk5xQb4k1ntU813sn1ZB8b50omNqvYcTy80Nndd1DsZK6jD/45fVnvbM9iR5fL2REOoHjEL X-Received: by 10.182.104.200 with SMTP id gg8mr2150393obb.45.1390860936741; Mon, 27 Jan 2014 14:15:36 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.87.202 with SMTP id r68ls779972qgd.50.gmail; Mon, 27 Jan 2014 14:15:36 -0800 (PST) X-Received: by 10.220.98.204 with SMTP id r12mr379345vcn.48.1390860936655; Mon, 27 Jan 2014 14:15:36 -0800 (PST) Received: from mail-ve0-f179.google.com (mail-ve0-f179.google.com [209.85.128.179]) by mx.google.com with ESMTPS id dc20si5641007vec.4.2014.01.27.14.15.36 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 27 Jan 2014 14:15:36 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.179; Received: by mail-ve0-f179.google.com with SMTP id jx11so3928323veb.10 for ; Mon, 27 Jan 2014 14:15:36 -0800 (PST) X-Received: by 10.220.186.202 with SMTP id ct10mr17534112vcb.14.1390860936534; Mon, 27 Jan 2014 14:15:36 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp162758vcz; Mon, 27 Jan 2014 14:15:36 -0800 (PST) X-Received: by 10.50.67.180 with SMTP id o20mr19777439igt.43.1390860935813; Mon, 27 Jan 2014 14:15:35 -0800 (PST) Received: from mail-ie0-f181.google.com (mail-ie0-f181.google.com [209.85.223.181]) by mx.google.com with ESMTPS id o8si21095491igk.65.2014.01.27.14.15.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 27 Jan 2014 14:15:35 -0800 (PST) Received-SPF: neutral (google.com: 209.85.223.181 is neither permitted nor denied by best guess record for domain of alex.elder@linaro.org) client-ip=209.85.223.181; Received: by mail-ie0-f181.google.com with SMTP id to1so1670628ieb.12 for ; Mon, 27 Jan 2014 14:15:35 -0800 (PST) X-Received: by 10.50.138.37 with SMTP id qn5mr2415908igb.36.1390860933028; Mon, 27 Jan 2014 14:15:33 -0800 (PST) Received: from [172.22.22.4] (c-71-195-31-37.hsd1.mn.comcast.net. [71.195.31.37]) by mx.google.com with ESMTPSA id x6sm49123714igb.3.2014.01.27.14.15.32 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 27 Jan 2014 14:15:32 -0800 (PST) Message-ID: <52E6DA84.6070505@linaro.org> Date: Mon, 27 Jan 2014 16:15:32 -0600 From: Alex Elder User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: patches@linaro.org Subject: Fwd: [PATCH 2/3] kernel.h: define u8, s8, u32, etc. limits References: <52BC4754.8060006@linaro.org> In-Reply-To: <52BC4754.8060006@linaro.org> X-Enigmail-Version: 1.5.2 X-Forwarded-Message-Id: <52BC4754.8060006@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: alex.elder@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , -------- Original Message -------- Subject: [PATCH 2/3] kernel.h: define u8, s8, u32, etc. limits Date: Thu, 26 Dec 2013 09:12:20 -0600 From: Alex Elder To: Sage Weil , David Miller , kuznet@ms2.inr.ac.ru, jmorris@namei.org, yoshfuji@linux-ipv6.org, kaber@trash.net, Al Viro , jeffm@suse.com, Steven Rostedt , Andrew Morton , mst@redhat.com, Ingo Molnar Create constants that define the maximum and minimum values representable by the kernel types u8, s8, u16, s16, and so on. Signed-off-by: Alex Elder --- include/linux/kernel.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/linux/kernel.h b/include/linux/kernel.h index ecb8754..915e07b 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -29,6 +29,19 @@ #define ULLONG_MAX (~0ULL) #define SIZE_MAX (~(size_t)0) +#define U8_MAX (~(u8)0) +#define S8_MAX ((s8)(U8_MAX>>1)) +#define S8_MIN ((s8)(-S8_MAX - 1)) +#define U16_MAX (~(u16)0) +#define S16_MAX ((s16)(U16_MAX>>1)) +#define S16_MIN ((s16)(-S16_MAX - 1)) +#define U32_MAX (~(u32)0) +#define S32_MAX ((s32)(U32_MAX>>1)) +#define S32_MIN ((s32)(-S32_MAX - 1)) +#define U64_MAX (~(u64)0) +#define S64_MAX ((s64)(U64_MAX>>1)) +#define S64_MIN ((s64)(-S64_MAX - 1)) + #define STACK_MAGIC 0xdeadbeef #define REPEAT_BYTE(x) ((~0ul / 0xff) * (x))