[{"id":1273,"web_url":"https://patchwork.libcamera.org/comment/1273/","msgid":"<20190405110656.GW23466@bigcity.dyn.berto.se>","date":"2019-04-05T11:06:56","subject":"Re: [libcamera-devel] [PATCH v3 1/8] libcamera: utils: Define BIT()\n\tmacro","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Jacopo,\n\nThanks for your patch.\n\nOn 2019-04-03 17:07:28 +0200, Jacopo Mondi wrote:\n> Define BIT(b_) macro which expands to a left bit shift.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> ---\n>  src/libcamera/include/utils.h | 1 +\n>  src/libcamera/utils.cpp       | 5 +++++\n>  2 files changed, 6 insertions(+)\n> \n> diff --git a/src/libcamera/include/utils.h b/src/libcamera/include/utils.h\n> index 79038a96feab..1a6cf7f7b9dc 100644\n> --- a/src/libcamera/include/utils.h\n> +++ b/src/libcamera/include/utils.h\n> @@ -10,6 +10,7 @@\n>  #include <memory>\n>  \n>  #define ARRAY_SIZE(a)\t(sizeof(a) / sizeof(a[0]))\n> +#define BIT(b_)\t\t(1 << (b_))\n>  \n>  namespace libcamera {\n>  \n> diff --git a/src/libcamera/utils.cpp b/src/libcamera/utils.cpp\n> index cd0fd7614cc7..1a5a2a03b1ca 100644\n> --- a/src/libcamera/utils.cpp\n> +++ b/src/libcamera/utils.cpp\n> @@ -24,6 +24,11 @@ namespace utils {\n>   * \\brief Determine the number of elements in the static array.\n>   */\n>  \n> +/**\n> + * \\def BIT(b)\n> + * \\brief Bitwise left shift by \\a b bits\n> + */\n> +\n>  /**\n>   * \\brief Strip the directory prefix from the path\n>   * \\param[in] path The path to process\n> -- \n> 2.21.0\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from mail-lf1-x143.google.com (mail-lf1-x143.google.com\n\t[IPv6:2a00:1450:4864:20::143])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E6B2660DB3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  5 Apr 2019 13:06:57 +0200 (CEST)","by mail-lf1-x143.google.com with SMTP id a6so4091277lfl.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 05 Apr 2019 04:06:57 -0700 (PDT)","from localhost (89-233-230-99.cust.bredband2.com. [89.233.230.99])\n\tby smtp.gmail.com with ESMTPSA id\n\tf18sm4599022lja.91.2019.04.05.04.06.56\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tFri, 05 Apr 2019 04:06:56 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to\n\t:user-agent; bh=zLosDecS8nw/b0emHNWm6n/BInyPHE2VIdl1Em8Xkt0=;\n\tb=RjeatuKn6OkGaGJJsnpbohDb1NwPJ/IndYJrYsEJRwM4W/oIqGYbSoSo3snSuYQAYV\n\tmMTfinSJY671IKJDh9i8mY/YrYL3cSMqVKk2nLysFwfwLFVkqSjlluxerkSQrpIYudx2\n\thYa6Q3WsYNofFSNp7TRCPvld6esd3ye43COfHSaBkGH2YpUm1W2lf3bePl6LdRWOAvq0\n\tb4Z22EkcwCO1Zuburq0TQmjYy+QmHoFpT20zYwevGYhMsN/5db5mb/yfQKO5DZpby4ZF\n\t6OJnwTnaaqciuslZm6LQ3ZU/g9GOj5+yOVJLNRcJzWKZIyCi2+G7EDwKgUaaMRIiDX2G\n\td6VA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to:user-agent;\n\tbh=zLosDecS8nw/b0emHNWm6n/BInyPHE2VIdl1Em8Xkt0=;\n\tb=AT3NxfPDZHad08qiBZ3G34cOgg5zAFgzFts/wj0cfzmR8EY9wpFAXmEhVxog4hra95\n\tr8THQw80lksWdVWqQZ9HLr41A+wL7cHzL/cSetmr6x/hTGeccvRHbfUHFExDNJkIUDrZ\n\tuOSTbaiZVr4GlcUyywmM7nEjsAjES2S2Jo4nUiak1s3pKtmi/hvBfkZ5D5vIJQqSy/Zu\n\tI5FTdlPU+T03hJ7Sm7Bw/tHqM3tqgee5svE4ipAfh/Ic15j/qDfSTuyD9Nr7gG2DuwdJ\n\t602Wi7wIb6EhzDj5RvXRU5YqMOLcTHQ4vEo/BTaFWPmtYbgl9HJGkS81yDnZtzrWYjg1\n\tGULg==","X-Gm-Message-State":"APjAAAUPJCCyJBV5vj+HabuUTVbFTQk9iY1LZb2nMkeJFwjostOO02gM\n\tqu24zaSWgOQcHVyymwQORH5hOA==","X-Google-Smtp-Source":"APXvYqzDlbw9Im+Z5Mt2RDVq6gJcEEScg8E7tvoDAu0QZ2ozippA3+bh0iW8MnNw2DAKqUMSa78BZw==","X-Received":"by 2002:ac2:44a6:: with SMTP id c6mr6511746lfm.31.1554462417339; \n\tFri, 05 Apr 2019 04:06:57 -0700 (PDT)","Date":"Fri, 5 Apr 2019 13:06:56 +0200","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190405110656.GW23466@bigcity.dyn.berto.se>","References":"<20190403150735.27580-1-jacopo@jmondi.org>\n\t<20190403150735.27580-2-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190403150735.27580-2-jacopo@jmondi.org>","User-Agent":"Mutt/1.11.3 (2019-02-01)","Subject":"Re: [libcamera-devel] [PATCH v3 1/8] libcamera: utils: Define BIT()\n\tmacro","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Fri, 05 Apr 2019 11:06:58 -0000"}},{"id":1277,"web_url":"https://patchwork.libcamera.org/comment/1277/","msgid":"<20190405113113.GA4755@pendragon.ideasonboard.com>","date":"2019-04-05T11:31:13","subject":"Re: [libcamera-devel] [PATCH v3 1/8] libcamera: utils: Define BIT()\n\tmacro","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nThank you for the patch.\n\nOn Wed, Apr 03, 2019 at 05:07:28PM +0200, Jacopo Mondi wrote:\n> Define BIT(b_) macro which expands to a left bit shift.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/libcamera/include/utils.h | 1 +\n>  src/libcamera/utils.cpp       | 5 +++++\n>  2 files changed, 6 insertions(+)\n> \n> diff --git a/src/libcamera/include/utils.h b/src/libcamera/include/utils.h\n> index 79038a96feab..1a6cf7f7b9dc 100644\n> --- a/src/libcamera/include/utils.h\n> +++ b/src/libcamera/include/utils.h\n> @@ -10,6 +10,7 @@\n>  #include <memory>\n>  \n>  #define ARRAY_SIZE(a)\t(sizeof(a) / sizeof(a[0]))\n> +#define BIT(b_)\t\t(1 << (b_))\n\nI'm curious, why the _ ? I'm also curious, why do you think we need this\nmacro ? :-) Usage of BIT() in the Linux kernel is partly to fix problems\nwith (1 << 31) on 32-bit platforms, with BIT() defined as (1UL << (nr)).\n\n>  \n>  namespace libcamera {\n>  \n> diff --git a/src/libcamera/utils.cpp b/src/libcamera/utils.cpp\n> index cd0fd7614cc7..1a5a2a03b1ca 100644\n> --- a/src/libcamera/utils.cpp\n> +++ b/src/libcamera/utils.cpp\n> @@ -24,6 +24,11 @@ namespace utils {\n>   * \\brief Determine the number of elements in the static array.\n>   */\n>  \n> +/**\n> + * \\def BIT(b)\n> + * \\brief Bitwise left shift by \\a b bits\n\nBitwise left shift of what ? :-)\n\n> + */\n> +\n>  /**\n>   * \\brief Strip the directory prefix from the path\n>   * \\param[in] path The path to process","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E6BE460DB3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  5 Apr 2019 13:31:24 +0200 (CEST)","from pendragon.ideasonboard.com (unknown [212.213.198.112])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 6006BE2;\n\tFri,  5 Apr 2019 13:31:24 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1554463884;\n\tbh=MId4XKxmRe8X+p/F6UchRNQsEOJC7MJWmfaHq1uBaZU=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=lXA0pP0+3OYDGMtx18GgzDa981/Z84k65Z8fcqhshsZymfCJRhGSutSauJxFY+fRC\n\tHOCDtlINhchrsm3l3fH9D374SOZYuixIrtXYTEwHyyWLSmFCc/K2X1rQ0q6ncnKF01\n\tg28cZzFmoO8/5w541slFTKgxjXEjzKZnFD0bl2Dg=","Date":"Fri, 5 Apr 2019 14:31:13 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190405113113.GA4755@pendragon.ideasonboard.com>","References":"<20190403150735.27580-1-jacopo@jmondi.org>\n\t<20190403150735.27580-2-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20190403150735.27580-2-jacopo@jmondi.org>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v3 1/8] libcamera: utils: Define BIT()\n\tmacro","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Fri, 05 Apr 2019 11:31:25 -0000"}},{"id":1305,"web_url":"https://patchwork.libcamera.org/comment/1305/","msgid":"<20190408074637.fjikyvcpvyhmqtho@uno.localdomain>","date":"2019-04-08T07:46:37","subject":"Re: [libcamera-devel] [PATCH v3 1/8] libcamera: utils: Define BIT()\n\tmacro","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Laurent,\n\nOn Fri, Apr 05, 2019 at 02:31:13PM +0300, Laurent Pinchart wrote:\n> Hi Jacopo,\n>\n> Thank you for the patch.\n>\n> On Wed, Apr 03, 2019 at 05:07:28PM +0200, Jacopo Mondi wrote:\n> > Define BIT(b_) macro which expands to a left bit shift.\n> >\n> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> > ---\n> >  src/libcamera/include/utils.h | 1 +\n> >  src/libcamera/utils.cpp       | 5 +++++\n> >  2 files changed, 6 insertions(+)\n> >\n> > diff --git a/src/libcamera/include/utils.h b/src/libcamera/include/utils.h\n> > index 79038a96feab..1a6cf7f7b9dc 100644\n> > --- a/src/libcamera/include/utils.h\n> > +++ b/src/libcamera/include/utils.h\n> > @@ -10,6 +10,7 @@\n> >  #include <memory>\n> >\n> >  #define ARRAY_SIZE(a)\t(sizeof(a) / sizeof(a[0]))\n> > +#define BIT(b_)\t\t(1 << (b_))\n>\n> I'm curious, why the _ ? I'm also curious, why do you think we need this\n\nTo avoid (unlikely) name clashes with other 'b' variables?\n\n> macro ? :-) Usage of BIT() in the Linux kernel is partly to fix problems\n> with (1 << 31) on 32-bit platforms, with BIT() defined as (1UL << (nr)).\n\nI just wanted something to avoid typing (1 << x) all the times, and\nwe're all used to the BIT() macro, so...\n\nI could drop this if it feels not necessary...\n\nThanks\n   j\n\n>\n> >\n> >  namespace libcamera {\n> >\n> > diff --git a/src/libcamera/utils.cpp b/src/libcamera/utils.cpp\n> > index cd0fd7614cc7..1a5a2a03b1ca 100644\n> > --- a/src/libcamera/utils.cpp\n> > +++ b/src/libcamera/utils.cpp\n> > @@ -24,6 +24,11 @@ namespace utils {\n> >   * \\brief Determine the number of elements in the static array.\n> >   */\n> >\n> > +/**\n> > + * \\def BIT(b)\n> > + * \\brief Bitwise left shift by \\a b bits\n>\n> Bitwise left shift of what ? :-)\n>\n> > + */\n> > +\n> >  /**\n> >   * \\brief Strip the directory prefix from the path\n> >   * \\param[in] path The path to process\n>\n> --\n> Regards,\n>\n> Laurent Pinchart","headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net\n\t[217.70.183.197])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B174B60B23\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  8 Apr 2019 09:45:49 +0200 (CEST)","from uno.localdomain (2-224-242-101.ip172.fastwebnet.it\n\t[2.224.242.101]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 21C3E1C0032;\n\tMon,  8 Apr 2019 07:45:48 +0000 (UTC)"],"X-Originating-IP":"2.224.242.101","Date":"Mon, 8 Apr 2019 09:46:37 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190408074637.fjikyvcpvyhmqtho@uno.localdomain>","References":"<20190403150735.27580-1-jacopo@jmondi.org>\n\t<20190403150735.27580-2-jacopo@jmondi.org>\n\t<20190405113113.GA4755@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\"; boundary=\"pzsjhspelgu2zk4p\"","Content-Disposition":"inline","In-Reply-To":"<20190405113113.GA4755@pendragon.ideasonboard.com>","User-Agent":"NeoMutt/20180716","Subject":"Re: [libcamera-devel] [PATCH v3 1/8] libcamera: utils: Define BIT()\n\tmacro","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Mon, 08 Apr 2019 07:45:49 -0000"}},{"id":1312,"web_url":"https://patchwork.libcamera.org/comment/1312/","msgid":"<20190408125327.GB4888@pendragon.ideasonboard.com>","date":"2019-04-08T12:53:27","subject":"Re: [libcamera-devel] [PATCH v3 1/8] libcamera: utils: Define BIT()\n\tmacro","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nThank you for the patch.\n\nOn Mon, Apr 08, 2019 at 09:46:37AM +0200, Jacopo Mondi wrote:\n> On Fri, Apr 05, 2019 at 02:31:13PM +0300, Laurent Pinchart wrote:\n> > On Wed, Apr 03, 2019 at 05:07:28PM +0200, Jacopo Mondi wrote:\n> >> Define BIT(b_) macro which expands to a left bit shift.\n> >>\n> >> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> >> ---\n> >>  src/libcamera/include/utils.h | 1 +\n> >>  src/libcamera/utils.cpp       | 5 +++++\n> >>  2 files changed, 6 insertions(+)\n> >>\n> >> diff --git a/src/libcamera/include/utils.h b/src/libcamera/include/utils.h\n> >> index 79038a96feab..1a6cf7f7b9dc 100644\n> >> --- a/src/libcamera/include/utils.h\n> >> +++ b/src/libcamera/include/utils.h\n> >> @@ -10,6 +10,7 @@\n> >>  #include <memory>\n> >>\n> >>  #define ARRAY_SIZE(a)\t(sizeof(a) / sizeof(a[0]))\n> >> +#define BIT(b_)\t\t(1 << (b_))\n> >\n> > I'm curious, why the _ ? I'm also curious, why do you think we need this\n> \n> To avoid (unlikely) name clashes with other 'b' variables?\n\nI don't think that's needed, the compiler will not mistake the macro\nargument name with local variables named 'b'.\n\n> > macro ? :-) Usage of BIT() in the Linux kernel is partly to fix problems\n> > with (1 << 31) on 32-bit platforms, with BIT() defined as (1UL << (nr)).\n> \n> I just wanted something to avoid typing (1 << x) all the times, and\n> we're all used to the BIT() macro, so...\n> \n> I could drop this if it feels not necessary...\n\nI'm OK keeping it if you think that's useful, but I think you should\nthen at least replace 1 with 1UL for the reason above.\n\n> >>  namespace libcamera {\n> >>\n> >> diff --git a/src/libcamera/utils.cpp b/src/libcamera/utils.cpp\n> >> index cd0fd7614cc7..1a5a2a03b1ca 100644\n> >> --- a/src/libcamera/utils.cpp\n> >> +++ b/src/libcamera/utils.cpp\n> >> @@ -24,6 +24,11 @@ namespace utils {\n> >>   * \\brief Determine the number of elements in the static array.\n> >>   */\n> >>\n> >> +/**\n> >> + * \\def BIT(b)\n> >> + * \\brief Bitwise left shift by \\a b bits\n> >\n> > Bitwise left shift of what ? :-)\n> >\n> >> + */\n> >> +\n> >>  /**\n> >>   * \\brief Strip the directory prefix from the path\n> >>   * \\param[in] path The path to process","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B446160B2E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  8 Apr 2019 14:53:39 +0200 (CEST)","from pendragon.ideasonboard.com (85-76-86-94-nat.elisa-mobile.fi\n\t[85.76.86.94])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C8A982C6;\n\tMon,  8 Apr 2019 14:53:38 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1554728019;\n\tbh=5hkyw2MC02mIzkUhoq4VXEX8g8sy8T3vY3UyLyCb5iw=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=YKMYuDF7rEqGXjpvQVt0RZpFQ8yCDs1PNJvLARSQpiQe7p6Lw1bvXdZmL76WdMbz3\n\t9VJDMrsqQcE3K3rpE/EtsLqEb8yIScgWPlWVp8xa3HogqnpxWwJer26hwWHzX2WLU0\n\txv+QoSlBsgawFDtoIeikOo4PSXg6kRFu9ar6eyHM=","Date":"Mon, 8 Apr 2019 15:53:27 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190408125327.GB4888@pendragon.ideasonboard.com>","References":"<20190403150735.27580-1-jacopo@jmondi.org>\n\t<20190403150735.27580-2-jacopo@jmondi.org>\n\t<20190405113113.GA4755@pendragon.ideasonboard.com>\n\t<20190408074637.fjikyvcpvyhmqtho@uno.localdomain>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20190408074637.fjikyvcpvyhmqtho@uno.localdomain>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v3 1/8] libcamera: utils: Define BIT()\n\tmacro","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Mon, 08 Apr 2019 12:53:39 -0000"}},{"id":1315,"web_url":"https://patchwork.libcamera.org/comment/1315/","msgid":"<20190408132010.7x34vjpijkpcdosk@uno.localdomain>","date":"2019-04-08T13:20:18","subject":"Re: [libcamera-devel] [PATCH v3 1/8] libcamera: utils: Define BIT()\n\tmacro","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Laurent,\n   I think I can live without this, I'll leave it out\n\nThanks\n   j\n\nOn Mon, Apr 08, 2019 at 03:53:27PM +0300, Laurent Pinchart wrote:\n> Hi Jacopo,\n>\n> Thank you for the patch.\n>\n> On Mon, Apr 08, 2019 at 09:46:37AM +0200, Jacopo Mondi wrote:\n> > On Fri, Apr 05, 2019 at 02:31:13PM +0300, Laurent Pinchart wrote:\n> > > On Wed, Apr 03, 2019 at 05:07:28PM +0200, Jacopo Mondi wrote:\n> > >> Define BIT(b_) macro which expands to a left bit shift.\n> > >>\n> > >> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> > >> ---\n> > >>  src/libcamera/include/utils.h | 1 +\n> > >>  src/libcamera/utils.cpp       | 5 +++++\n> > >>  2 files changed, 6 insertions(+)\n> > >>\n> > >> diff --git a/src/libcamera/include/utils.h b/src/libcamera/include/utils.h\n> > >> index 79038a96feab..1a6cf7f7b9dc 100644\n> > >> --- a/src/libcamera/include/utils.h\n> > >> +++ b/src/libcamera/include/utils.h\n> > >> @@ -10,6 +10,7 @@\n> > >>  #include <memory>\n> > >>\n> > >>  #define ARRAY_SIZE(a)\t(sizeof(a) / sizeof(a[0]))\n> > >> +#define BIT(b_)\t\t(1 << (b_))\n> > >\n> > > I'm curious, why the _ ? I'm also curious, why do you think we need this\n> >\n> > To avoid (unlikely) name clashes with other 'b' variables?\n>\n> I don't think that's needed, the compiler will not mistake the macro\n> argument name with local variables named 'b'.\n>\n> > > macro ? :-) Usage of BIT() in the Linux kernel is partly to fix problems\n> > > with (1 << 31) on 32-bit platforms, with BIT() defined as (1UL << (nr)).\n> >\n> > I just wanted something to avoid typing (1 << x) all the times, and\n> > we're all used to the BIT() macro, so...\n> >\n> > I could drop this if it feels not necessary...\n>\n> I'm OK keeping it if you think that's useful, but I think you should\n> then at least replace 1 with 1UL for the reason above.\n>\n> > >>  namespace libcamera {\n> > >>\n> > >> diff --git a/src/libcamera/utils.cpp b/src/libcamera/utils.cpp\n> > >> index cd0fd7614cc7..1a5a2a03b1ca 100644\n> > >> --- a/src/libcamera/utils.cpp\n> > >> +++ b/src/libcamera/utils.cpp\n> > >> @@ -24,6 +24,11 @@ namespace utils {\n> > >>   * \\brief Determine the number of elements in the static array.\n> > >>   */\n> > >>\n> > >> +/**\n> > >> + * \\def BIT(b)\n> > >> + * \\brief Bitwise left shift by \\a b bits\n> > >\n> > > Bitwise left shift of what ? :-)\n> > >\n> > >> + */\n> > >> +\n> > >>  /**\n> > >>   * \\brief Strip the directory prefix from the path\n> > >>   * \\param[in] path The path to process\n>\n> --\n> Regards,\n>\n> Laurent Pinchart","headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net\n\t[217.70.183.195])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 866C460004\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  8 Apr 2019 15:19:35 +0200 (CEST)","from uno.localdomain (2-224-242-101.ip172.fastwebnet.it\n\t[2.224.242.101]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay3-d.mail.gandi.net (Postfix) with ESMTPSA id F11DE60007;\n\tMon,  8 Apr 2019 13:19:34 +0000 (UTC)"],"X-Originating-IP":"2.224.242.101","Date":"Mon, 8 Apr 2019 15:20:18 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190408132010.7x34vjpijkpcdosk@uno.localdomain>","References":"<20190403150735.27580-1-jacopo@jmondi.org>\n\t<20190403150735.27580-2-jacopo@jmondi.org>\n\t<20190405113113.GA4755@pendragon.ideasonboard.com>\n\t<20190408074637.fjikyvcpvyhmqtho@uno.localdomain>\n\t<20190408125327.GB4888@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\"; boundary=\"xnr4qtiydhqgfxoz\"","Content-Disposition":"inline","In-Reply-To":"<20190408125327.GB4888@pendragon.ideasonboard.com>","User-Agent":"NeoMutt/20180716","Subject":"Re: [libcamera-devel] [PATCH v3 1/8] libcamera: utils: Define BIT()\n\tmacro","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Mon, 08 Apr 2019 13:19:35 -0000"}}]