[libgpiod,06/19] bindings: cxx: initialise bitset with integer instead of string
diff mbox series

Message ID 20191115144355.975-7-warthog618@gmail.com
State New
Headers show
Series
  • Add support for bias flags and SET_CONFIG
Related show

Commit Message

Kent Gibson Nov. 15, 2019, 2:43 p.m. UTC
Initialising bitsets with string is inefficient and confusing.
Initialise them with the corresponding int instead.

Signed-off-by: Kent Gibson <warthog618@gmail.com>
---
 bindings/cxx/line_bulk.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Bartosz Golaszewski Nov. 18, 2019, 1:51 p.m. UTC | #1
pt., 15 lis 2019 o 15:44 Kent Gibson <warthog618@gmail.com> napisał(a):
>
> Initialising bitsets with string is inefficient and confusing.
> Initialise them with the corresponding int instead.
>

I'm not a native English speaker, of course, so correcting you on
spelling may be risky but I generally try to stick to American
spelling so "initialise" looks somehow wrong to me. :) Anyway, this is
just the commit message, so never mind that.

> Signed-off-by: Kent Gibson <warthog618@gmail.com>
> ---
>  bindings/cxx/line_bulk.cpp | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/bindings/cxx/line_bulk.cpp b/bindings/cxx/line_bulk.cpp
> index 8369930..c708c8b 100644
> --- a/bindings/cxx/line_bulk.cpp
> +++ b/bindings/cxx/line_bulk.cpp
> @@ -11,9 +11,9 @@
>
>  namespace gpiod {
>
> -const ::std::bitset<32> line_request::FLAG_ACTIVE_LOW("001");
> -const ::std::bitset<32> line_request::FLAG_OPEN_SOURCE("010");
> -const ::std::bitset<32> line_request::FLAG_OPEN_DRAIN("100");
> +const ::std::bitset<32> line_request::FLAG_ACTIVE_LOW(GPIOD_BIT(0));
> +const ::std::bitset<32> line_request::FLAG_OPEN_SOURCE(GPIOD_BIT(1));
> +const ::std::bitset<32> line_request::FLAG_OPEN_DRAIN(GPIOD_BIT(2));
>
>  namespace {
>
> --
> 2.24.0
>
Kent Gibson Nov. 18, 2019, 2:17 p.m. UTC | #2
On Mon, Nov 18, 2019 at 02:51:42PM +0100, Bartosz Golaszewski wrote:
> pt., 15 lis 2019 o 15:44 Kent Gibson <warthog618@gmail.com> napisał(a):
> >
> > Initialising bitsets with string is inefficient and confusing.
> > Initialise them with the corresponding int instead.
> >
> 
> I'm not a native English speaker, of course, so correcting you on
> spelling may be risky but I generally try to stick to American
> spelling so "initialise" looks somehow wrong to me. :) Anyway, this is
> just the commit message, so never mind that.
> 

And I speak English, not American, so I didn't even notice.
I will try to keep that in mind though.

Kent.

Patch
diff mbox series

diff --git a/bindings/cxx/line_bulk.cpp b/bindings/cxx/line_bulk.cpp
index 8369930..c708c8b 100644
--- a/bindings/cxx/line_bulk.cpp
+++ b/bindings/cxx/line_bulk.cpp
@@ -11,9 +11,9 @@ 
 
 namespace gpiod {
 
-const ::std::bitset<32> line_request::FLAG_ACTIVE_LOW("001");
-const ::std::bitset<32> line_request::FLAG_OPEN_SOURCE("010");
-const ::std::bitset<32> line_request::FLAG_OPEN_DRAIN("100");
+const ::std::bitset<32> line_request::FLAG_ACTIVE_LOW(GPIOD_BIT(0));
+const ::std::bitset<32> line_request::FLAG_OPEN_SOURCE(GPIOD_BIT(1));
+const ::std::bitset<32> line_request::FLAG_OPEN_DRAIN(GPIOD_BIT(2));
 
 namespace {