Re: Computer programmers' habits in electronics
- From: Spehro Pefhany <speffSNIP@xxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 22 Dec 2005 02:05:19 -0500
On Thu, 22 Dec 2005 04:44:00 GMT, the renowned "Mike Young"
<boat042-spam@xxxxxxxxx> wrote:
>"Spehro Pefhany" <speffSNIP@xxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>news:0u2kq1h7cm70jgjmj5hari4kug5308ihtn@xxxxxxxxxx
>>> std::reverse(pStr, pStr + (len ? len : strlen(pStr)));
>>>}
>>
>> Isn't that kinda cheating?
>
>I suppose you should also ding me for <string.h>.
>
>It's a valid answer, and meaningful of itself. The follow up questions would
>bring it back to where we started.
>
>If you're not tired of the game yet, write:
>
>// return true if val is an integer power of 2; false otherwise.
>bool IsPowerOf2(unsigned val);
bool IsPowerOf2(unsigned val)
{
unsigned i=val, j=1;
while (i >>= 1) j*=2;
return (j == val);
}
Best regards,
Spehro Pefhany
--
"it's the network..." "The Journey is the reward"
speff@xxxxxxxxxxxx Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog Info for designers: http://www.speff.com
.
- Follow-Ups:
- Re: Computer programmers' habits in electronics
- From: John Miles
- Re: Computer programmers' habits in electronics
- References:
- Re: Computer programmers' habits in electronics
- From: Rich Grise, but drunk
- Re: Computer programmers' habits in electronics
- From: Rich Grise, but drunk
- Re: Computer programmers' habits in electronics
- From: Tim Wescott
- Re: Computer programmers' habits in electronics
- From: Spehro Pefhany
- Re: Computer programmers' habits in electronics
- From: Mike Young
- Re: Computer programmers' habits in electronics
- From: Spehro Pefhany
- Re: Computer programmers' habits in electronics
- From: Mike Young
- Re: Computer programmers' habits in electronics
- Prev by Date: 60 Hz inductor design re-visited
- Next by Date: Re: simulation of microcontrollers
- Previous by thread: Re: Computer programmers' habits in electronics
- Next by thread: Re: Computer programmers' habits in electronics
- Index(es):
Loading