From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 295101A1E43 for ; Wed, 26 Oct 2016 19:21:50 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP; 26 Oct 2016 19:21:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,404,1473145200"; d="scan'208";a="894470800" Received: from orsmsx104.amr.corp.intel.com ([10.22.225.131]) by orsmga003.jf.intel.com with ESMTP; 26 Oct 2016 19:21:27 -0700 Received: from orsmsx160.amr.corp.intel.com (10.22.226.43) by ORSMSX104.amr.corp.intel.com (10.22.225.131) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 26 Oct 2016 19:21:26 -0700 Received: from orsmsx113.amr.corp.intel.com ([169.254.9.50]) by ORSMSX160.amr.corp.intel.com ([10.22.226.43]) with mapi id 14.03.0248.002; Wed, 26 Oct 2016 19:21:25 -0700 From: "Kinney, Michael D" To: Laszlo Ersek , edk2-devel-01 , "Kinney, Michael D" CC: "Ni, Ruiyu" , Tim He , "Tian, Feng" , "Dong, Eric" , Cecil Sheng , Ard Biesheuvel , "Justen, Jordan L" , "Gao, Liming" , "Bi, Dandan" , "Wu, Jiaxin" , Gary Lin , "Zeng, Star" , "Daryl McDaniel" , "Carsey, Jaben" , "Fu, Siyuan" , "Fan, Jeff" , "Zhang, Chao B" , "Wei, David" Thread-Topic: [edk2] [PATCH 05/47] MdePkg/Include/Base.h: introduce the ARRAY_SIZE() function-like macro Thread-Index: AQHSL7v1DBtP2bNQtUOr7OKGyveNkaC7TLHAgAB464D//8x6QA== Date: Thu, 27 Oct 2016 02:21:25 +0000 Message-ID: References: <20161026190504.9888-1-lersek@redhat.com> <20161026190504.9888-6-lersek@redhat.com> <5cd1b4e5-a1ec-47e7-3e99-95bb1a55d6e9@redhat.com> In-Reply-To: <5cd1b4e5-a1ec-47e7-3e99-95bb1a55d6e9@redhat.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiODVjMGI2ZGMtODQ1YS00NTE0LWIxMTctOTI5Y2ZjZDAzNzhhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IkZjVzR5TXYzZVwvZUpCWXhaQTQ4Wkg2dEJDbXU3dGFkWXN1M1wvNlNlRFwvXC84PSJ9 x-originating-ip: [10.22.254.140] MIME-Version: 1.0 Subject: Re: [PATCH 05/47] MdePkg/Include/Base.h: introduce the ARRAY_SIZE() function-like macro X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Oct 2016 02:21:50 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable With that change: Reviewed-by: Michael Kinney Mike > -----Original Message----- > From: Laszlo Ersek [mailto:lersek@redhat.com] > Sent: Wednesday, October 26, 2016 3:26 PM > To: Kinney, Michael D ; edk2-devel-01 devel@ml01.01.org> > Cc: Ni, Ruiyu ; Tim He ; Tian, Feng > ; Dong, Eric ; Cecil Sheng > ; Ard Biesheuvel ; Justen= , Jordan L > ; Gao, Liming ; Bi, Dand= an > ; Wu, Jiaxin ; Gary Lin ; > Zeng, Star ; Daryl McDaniel ; Carsey, > Jaben ; Fu, Siyuan ; Fan, Je= ff > ; Zhang, Chao B ; Wei, David > > Subject: Re: [edk2] [PATCH 05/47] MdePkg/Include/Base.h: introduce the AR= RAY_SIZE() > function-like macro >=20 > On 10/27/16 00:13, Kinney, Michael D wrote: > > Hi Laszlo, > > > > One comment inline below. > > > > Mike > > > >> -----Original Message----- > >> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of= Laszlo Ersek > >> Sent: Wednesday, October 26, 2016 12:04 PM > >> To: edk2-devel-01 > >> Cc: Ni, Ruiyu ; Tim He ; Tian, F= eng > >> ; Kinney, Michael D ;= Dong, Eric > >> ; Cecil Sheng ; Ard Biesheuv= el > >> ; Justen, Jordan L ; Gao, > Liming > >> ; Bi, Dandan ; Wu, Jiaxin > >> ; Gary Lin ; Zeng, Star ; > >> Daryl McDaniel ; Carsey, Jaben ; > >> Fu, Siyuan ; Fan, Jeff ; Zhan= g, Chao B > >> ; Wei, David > >> Subject: [edk2] [PATCH 05/47] MdePkg/Include/Base.h: introduce the ARR= AY_SIZE() > >> function-like macro > >> > >> Several modules use ARRAY_SIZE() already; centralize the definition. (= The > >> module-specific macro definitions are guarded by #ifndef directives at > >> this point.) > >> > >> Cc: Ard Biesheuvel > >> Cc: Cecil Sheng > >> Cc: Chao Zhang > >> Cc: Dandan Bi > >> Cc: Daryl McDaniel > >> Cc: David Wei > >> Cc: Eric Dong > >> Cc: Feng Tian > >> Cc: Gary Lin > >> Cc: Jaben Carsey > >> Cc: Jeff Fan > >> Cc: Jiaxin Wu > >> Cc: Jordan Justen > >> Cc: Liming Gao > >> Cc: Michael D Kinney > >> Cc: Ruiyu Ni > >> Cc: Siyuan Fu > >> Cc: Star Zeng > >> Cc: Tim He > >> Contributed-under: TianoCore Contribution Agreement 1.0 > >> Signed-off-by: Laszlo Ersek > >> --- > >> MdePkg/Include/Base.h | 13 +++++++++++++ > >> 1 file changed, 13 insertions(+) > >> > >> diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h > >> index c66614846488..8bdb257e37bd 100644 > >> --- a/MdePkg/Include/Base.h > >> +++ b/MdePkg/Include/Base.h > >> @@ -1211,5 +1211,18 @@ typedef UINTN RETURN_STATUS; > >> #define RETURN_ADDRESS(L) ((VOID *) 0) > >> #endif > >> > >> +/** > >> + Return the number of elements in an array. > >> + > >> + @param Array An object of array type. Array is only used as an ar= gument to > >> + the sizeof operator, therefore Array is never evalua= ted. The > >> + caller is responsible for ensuring that Array's type= is not > >> + incomplete; that is, Array must have known constant = size. > >> + > >> + @return The number of elements in Array. The result has type UINTN. > >> + > >> +**/ > >> +#define ARRAY_SIZE(Array) (sizeof (Array) / sizeof (Array)[0]) > > > > I think adding one extra set of () makes this clearer: > > > > #define ARRAY_SIZE(Array) (sizeof (Array) / sizeof ((Array)[0])) >=20 > Sure, will do. >=20 > Thanks! > Laszlo >=20 > >> + > >> #endif > >> > >> -- > >> 2.9.2 > >> > >> > >> _______________________________________________ > >> edk2-devel mailing list > >> edk2-devel@lists.01.org > >> https://lists.01.org/mailman/listinfo/edk2-devel