Re: A Problem With GD



On Sat, 11 Mar 2006 12:57:38 -0800, robic0 wrote:

On Sat, 11 Mar 2006 12:46:47 -0800, robic0 wrote:

On 11 Mar 2006 17:47:56 GMT, Abigail <abigail@xxxxxxxxxx> wrote:

Mark Manning (markem@xxxxxxxxxxx) wrote on MMMMDLXXV September MCMXCIII
in <URL:news:1215ur1bndeb911@xxxxxxxxxxxxxxxxxx>:
<> Glenn Jackman wrote:
<> > At 2006-03-08 04:48AM, Dave Weaver <zen13097@xxxxxxxxx> wrote:
<> >
<> > However,
<> > $i = -1
<> > while (++$i < 10) {...
<> > does.
<> >
<>
<> What is your favorite method for implementing a toggle switch? Mine is:
<>
<> $var = ($var + 1) % 2;


If I'm going to use the switch in boolean context only:

$var = !$var;

else:

$var = 1 - $var;
^^^^^^^^^^^^^^^
This is the typical proto C bool toggle also
$var = 0;
$var = 1 - $var;
...

or:

($var += 1) %= 2;


Abigail

In this vane, whats a favorite way to strip a bit from map

$var &= ~($bit << $position); ?
Yeah well, before this gets jumped (hijaakd) for the wrong reason

single bit:
$var &= ~(1 << $position); ?

or for a bit range starting from $position:
sheesh, bit range or some value (selected bits) starting from position
$number = 230010;
$var &= ~($number << $position);



.



Relevant Pages

  • Re: A Problem With GD
    ... Glenn Jackman wrote: ... What is your favorite method for implementing a toggle switch? ... before this gets jumped (hijaakd) for the wrong reason ...
    (comp.lang.perl.misc)
  • Re: A Problem With GD
    ... Mark Manning wrote on MMMMDLXXV September MCMXCIII ... Glenn Jackman wrote: ... What is your favorite method for implementing a toggle switch? ...
    (comp.lang.perl.misc)
  • Re: A Problem With GD
    ... Glenn Jackman wrote: ... What is your favorite method for implementing a toggle switch? ... whats a favorite way to strip a bit from map ...
    (comp.lang.perl.misc)