From: Michael Buesch <mb@bu3sch.de>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: "Gábor Stefanik" <netrolller.3d@gmail.com>,
radiotap@radiotap.org,
linux-wireless <linux-wireless@vger.kernel.org>
Subject: Re: [Proposal]TX flags
Date: Thu, 16 Apr 2009 21:10:04 +0200 [thread overview]
Message-ID: <200904162110.05150.mb@bu3sch.de> (raw)
In-Reply-To: <1239908374.26575.20.camel@johannes.local>
On Thursday 16 April 2009 20:59:34 Johannes Berg wrote:
> On Thu, 2009-04-16 at 20:47 +0200, G=C3=A1bor Stefanik wrote:
>=20
> > Alternatively, the meanings of the {0,0} and {1,1} cases could be
> > switched around (making the {0,0} case more logical, at the expense=
of
> > the {1,1} one):
> >=20
> > TX Flags absent: Use RTS & CTS as needed.
> > TX Flags present: {
> > RTS=3D0, CTS=3D0: Use RTS & CTS as needed.
> > RTS=3D0, CTS=3D1: Use CTS-to-self.
> > RTS=3D1, CTS=3D0: Use RTS/CTS-handshake.
> > RTS=3D1, CTS=3D1: Use neither RTS nor CTS.
The first and the last thing let my head explode, because it's not what=
somebody
would expect from such bits. This kind of logic is also used in wext. A=
nd it's why I hate wext.
"bit0 means x, bit1 means y, buuuuuuuuuuuuuuuut iff both bits are set t=
he whole logic
is inverted and whatever..."
That complicates _every_ single test of the bit (always need if (bit0 i=
s set but not bit1))
It produces spaghetti code interpreting these bits with lots of branche=
s and special
conditions that nobody does understand by reading the code alone.
If you can't encode your functionality into a boolean, do _NOT_ use bit=
s to encode it.
Use integers to encode tristate or quadstate or whatever.
You essentially _did_ that already, if you look at your bits. You use t=
he two individual bits
as 2bit integer value. So why not spell it out and use an integer field=
for that information?
--=20
Greetings, Michael.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireles=
s" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: Michael Buesch <mb-fseUSCV1ubazQB+pC5nmwQ@public.gmane.org>
To: Johannes Berg <johannes-cdvu00un1VgdHxzADdlk8Q@public.gmane.org>
Cc: "Gábor Stefanik"
<netrolller.3d-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
radiotap-sUITvd46vNxg9hUCZPvPmw@public.gmane.org,
linux-wireless
<linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [Proposal]TX flags
Date: Thu, 16 Apr 2009 21:10:04 +0200 [thread overview]
Message-ID: <200904162110.05150.mb@bu3sch.de> (raw)
In-Reply-To: <1239908374.26575.20.camel-YfaajirXv2244ywRPIzf9A@public.gmane.org>
On Thursday 16 April 2009 20:59:34 Johannes Berg wrote:
> On Thu, 2009-04-16 at 20:47 +0200, Gábor Stefanik wrote:
>
> > Alternatively, the meanings of the {0,0} and {1,1} cases could be
> > switched around (making the {0,0} case more logical, at the expense of
> > the {1,1} one):
> >
> > TX Flags absent: Use RTS & CTS as needed.
> > TX Flags present: {
> > RTS=0, CTS=0: Use RTS & CTS as needed.
> > RTS=0, CTS=1: Use CTS-to-self.
> > RTS=1, CTS=0: Use RTS/CTS-handshake.
> > RTS=1, CTS=1: Use neither RTS nor CTS.
The first and the last thing let my head explode, because it's not what somebody
would expect from such bits. This kind of logic is also used in wext. And it's why I hate wext.
"bit0 means x, bit1 means y, buuuuuuuuuuuuuuuut iff both bits are set the whole logic
is inverted and whatever..."
That complicates _every_ single test of the bit (always need if (bit0 is set but not bit1))
It produces spaghetti code interpreting these bits with lots of branches and special
conditions that nobody does understand by reading the code alone.
If you can't encode your functionality into a boolean, do _NOT_ use bits to encode it.
Use integers to encode tristate or quadstate or whatever.
You essentially _did_ that already, if you look at your bits. You use the two individual bits
as 2bit integer value. So why not spell it out and use an integer field for that information?
--
Greetings, Michael.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2009-04-16 19:11 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-15 0:33 [Proposal]TX flags Gábor Stefanik
2009-04-15 0:33 ` Gábor Stefanik
2009-04-16 15:37 ` David Young
2009-04-16 15:37 ` David Young
2009-04-16 17:28 ` Johannes Berg
2009-04-16 17:28 ` Johannes Berg
2009-04-16 18:47 ` Gábor Stefanik
2009-04-16 18:47 ` Gábor Stefanik
2009-04-16 18:59 ` Johannes Berg
2009-04-16 18:59 ` Johannes Berg
2009-04-16 19:10 ` Michael Buesch [this message]
2009-04-16 19:10 ` Michael Buesch
2009-04-16 20:48 ` David Young
2009-04-16 20:48 ` David Young
2009-04-17 1:24 ` Gábor Stefanik
2009-04-17 1:24 ` Gábor Stefanik
2009-04-17 9:50 ` Johannes Berg
2009-04-17 9:50 ` Johannes Berg
2009-04-16 20:33 ` David Young
2009-04-16 20:33 ` David Young
2009-04-16 20:48 ` Johannes Berg
2009-04-16 20:48 ` Johannes Berg
2010-03-22 19:32 ` Michael Stahn
2010-03-23 0:42 ` Bruno Randolf
2010-03-23 15:50 ` Michael Stahn
2010-03-24 11:15 ` Bruno Randolf
2010-03-24 19:43 ` Pavel Roskin
2010-03-24 20:26 ` Gábor Stefanik
2010-03-25 1:22 ` Michael Stahn
2010-03-25 20:32 ` Gábor Stefanik
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=200904162110.05150.mb@bu3sch.de \
--to=mb@bu3sch.de \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=netrolller.3d@gmail.com \
--cc=radiotap@radiotap.org \
/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.