Bitwise Operators:
Pg 63:
/* getbits: get n bits from position p */
unigned int getbits(unsigned int x, int p, int n)
{
return (x >> (p + 1 - n)) & ~(~0 << n);
}
Why is the book using p + 1 - n?! According to my logic it should use p - 1.
Edward
__
Rainer Weikusat wrote:
> That's you're preferred set of workarounds.
I suspect that we're all in "violent agreement" that different users (or types
of users) have different preferences and priorities. In the general case there
is definitely an issue to be solved - just different approaches to
Le 23/06/2016 18:33, Rainer Weikusat a écrit :
'Assigning names based on
MAC addresses' is problematic as a MAC address is a typically
programmable property of a NIC.
Yes, *you*, the admin, can change the MAC address. The kernel won't
do it, and the hotplugger will do it only if *you* ed
hi,
I use the 'rfkill' command for this
try 'rfkill list'
then 'rfkill un/block' followed by the nr of device found in list
hope it helps
ciao
___
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
Hi,
Never mind, I understood it.
Edward
On 24/06/2016, Edward Bartolo wrote:
> Bitwise Operators:
>
> Pg 63:
> /* getbits: get n bits from position p */
>
> unigned int getbits(unsigned int x, int p, int n)
> {
>return (x >> (p + 1 - n)) & ~(~0 << n);
> }
>
> Why is the book using p + 1 - n
On Thu, Jun 23, 2016 at 11:34:23PM -0400, Peter Olson wrote:
> > On June 23, 2016 at 10:48 AM Edward Bartolo wrote:
> > if (count > 0)
> > while(putchar(' ') && --count);
>
> I strongly recommend using the continue statement here:
>
> while(putchar(' ') && --count) continue;
>
> The
Peter Olson writes:
>> On June 23, 2016 at 10:48 AM Edward Bartolo wrote:
>> if (count > 0)
>> while(putchar(' ') && --count);
>
> I strongly recommend using the continue statement here:
>
> while(putchar(' ') && --count) continue;
I and I strongly recommend against it. The continue
Rainer Weikusat schreef op 2016-06-24 18:17:
Peter Olson writes:
On June 23, 2016 at 10:48 AM Edward Bartolo wrote:
if (count > 0)
while(putchar(' ') && --count);
I strongly recommend using the continue statement here:
while(putchar(' ') && --count) continue;
I and I strongly
On 2016-06-24 12:17, Rainer Weikusat wrote:
> Peter Olson writes:
>>> On June 23, 2016 at 10:48 AM Edward Bartolo wrote:
>>> if (count > 0)
>>> while(putchar(' ') && --count);
>>
>> I strongly recommend using the continue statement here:
>>
>> while(putchar(' ') && --count) continue;
> On June 24, 2016 at 12:45 PM Albert van der Horst
> wrote:
[...]
> Sorry, but that means your brain is not wired correctly to recognize
> == as the symmetric operation that it is.
> Would you be equally fuzzy about
> mask = 0x42 & abc;
> versus
> mask = abc & 0x42;
> ?
I'm perfectly
Peter Olson writes:
> On 2016-06-24 12:17, Rainer Weikusat wrote:
>> Peter Olson writes:
On June 23, 2016 at 10:48 AM Edward Bartolo wrote:
if (count > 0)
while(putchar(' ') && --count);
>>>
>>> I strongly recommend using the continue statement here:
>>>
>>> while(putc
Simon Hobson writes:
> Rainer Weikusat wrote:
>> That's you're preferred set of workarounds.
>
> I suspect that we're all in "violent agreement" that different users
> (or types of users) have different preferences and priorities. In the
> general case there is definitely an issue to be solved -
On Thu, 23 Jun 2016 23:34:23 -0400 (EDT)
Peter Olson wrote:
> > On June 23, 2016 at 10:48 AM Edward Bartolo
> > wrote: if (count > 0)
> > while(putchar(' ') && --count);
>
> I strongly recommend using the continue statement here:
>
> while(putchar(' ') && --count) continue;
>
> Th
Albert van der Horst writes:
[...]
>>> Another habit I have is to avoid a statement like:
>>>
>>> if (abc == 42)
>>>
>>> and write it as
>>>
>>> if (42 == abc)
>>>
>>> instead.
>>
>> That's a habit of many people who either believe to be master yoda
>> ('Your sister she is') or who belie
On Fri, 24 Jun 2016 09:19:40 +0200
Edward Bartolo wrote:
> Bitwise Operators:
>
> Pg 63:
> /* getbits: get n bits from position p */
>
> unigned int getbits(unsigned int x, int p, int n)
> {
>return (x >> (p + 1 - n)) & ~(~0 << n);
> }
Stuff like this is the reason I soon abandoned K&R as
Steve Litt wrote:
> On Fri, 24 Jun 2016 09:19:40 +0200
> Edward Bartolo wrote:
>
> > Bitwise Operators:
> >
> > Pg 63:
> > /* getbits: get n bits from position p */
> >
> > unigned int getbits(unsigned int x, int p, int n)
> > {
> >return (x >> (p + 1 - n)) & ~(~0 << n);
> > }
>
> Stuff li
On Fri, 24 Jun 2016 19:41:54 +0100, Rainer Weikusat wrote:
[...]
> If you want
> a mathematical example, picture somone always writing
>
> x / (1/n)
>
> instead of
>
> x * n
Not to undermine your point, just a minor quibble: The example
is flawed in that above terms are not quite equivalent, a
On Fri, Jun 24, 2016 at 09:44:31PM +0200, Irrwahn wrote:
> On Fri, 24 Jun 2016 19:41:54 +0100, Rainer Weikusat wrote:
> [...]
> > If you want
> > a mathematical example, picture somone always writing
> >
> > x / (1/n)
> >
> > instead of
> >
> > x * n
>
> Not to undermine your point, just a mino
On Fri, 24 Jun 2016 22:36:33 +0100, Katolaz wrote:
> On Fri, Jun 24, 2016 at 09:44:31PM +0200, Irrwahn wrote:
>> On Fri, 24 Jun 2016 19:41:54 +0100, Rainer Weikusat wrote:
>> [...]
>>> If you want
>>> a mathematical example, picture somone always writing
>>>
>>> x / (1/n)
>>>
>>> instead of
>>>
>>>
On Fri, 24 Jun 2016 14:33:21 -0400, Steve Litt wrote:
[...]
> I often use continue and break, but every time I do, I make a mental
> note that I'm decreasing modularity and thus reducing the scalability
> of my code. Of course, I might have also increased my code's
> readability by reducing redunda
On Fri, 2016-06-24 at 15:11 -0400, Steve Litt wrote:
> Stuff like this is the reason I soon abandoned K&R as a learning
> tool,
> and used it only to determine the official behavior of C.
>
> Bit stuffing, sliding and masking were a tool of the assembly
> programmer
> back when your RAM could be c
Hi all,
On 06/25/2016 12:16 AM, Irrwahn wrote:
Well, AIUI it was supposed to be a mathematical example, not a
code snippet, but apart from that — yes, indeed. Of course unless
x happens to be of floating point type, and n != 0. But then the
results for n < -1 or n > 1 would presumably come as
On Sat, Jun 25, 2016 at 01:21:33AM +0200, Irrwahn wrote:
> On Fri, 24 Jun 2016 14:33:21 -0400, Steve Litt wrote:
> [...]
> > I often use continue and break, but every time I do, I make a mental
> > note that I'm decreasing modularity and thus reducing the scalability
> > of my code. Of course, I mi
23 matches
Mail list logo