Re: bitwise operations

2004-06-18 Thread Alfredo Braunstein
Angus Leeming wrote: >> Alternatively, you could as well specify that if you set >> child_redirect_stderr you need *not* to set child_stdout nor >> child_stderr, and have child_stdout=100, child_stderr=010, >> child_redirect=101 > > But if (mode = child_stdout), then (mode & child_redirect) == tr

Re: bitwise operations

2004-06-18 Thread Angus Leeming
Alfredo Braunstein wrote: > Angus Leeming wrote: > >> This works well enough, but I was wondering if, by choosing a >> different value for child_redirect_stderr, I could avoid the run time >> check: >> if (mode & child_redirect_stderr) { >> mode |= child_stdout; >> if (mode & child_stderr) mode ^

Re: bitwise operations

2004-06-18 Thread Alfredo Braunstein
Angus Leeming wrote: > This works well enough, but I was wondering if, by choosing a > different value for child_redirect_stderr, I could avoid the run time > check: > if (mode & child_redirect_stderr) { > mode |= child_stdout; > if (mode & child_stderr) mode ^= child_stderr; > } Alternatively, y

Re: bitwise operations

2004-06-18 Thread Angus Leeming
On Friday 18 June 2004 10:49 am, Helge Hafting wrote: > Angus Leeming wrote: > >Can I choose a value for "d" such that I don't need to modify > > "val" in foo, below? I've tried and failed and so have resorted > > to this runtime modification. > > > >int const a = 1; > >int const b = 2; > >

Re: bitwise operations

2004-06-17 Thread Lars Gullik Bjønnes
Angus Leeming <[EMAIL PROTECTED]> writes: | Can I choose a value for "d" such that I don't need to modify "val" in | foo, below? I've tried and failed and so have resorted to this runtime | modification. > | int const a = 1; | int const b = 2; | int const c = 4; | int const d = 8;

bitwise operations

2004-06-17 Thread Angus Leeming
Can I choose a value for "d" such that I don't need to modify "val" in foo, below? I've tried and failed and so have resorted to this runtime modification. int const a = 1; int const b = 2; int const c = 4; int const d = 8; void foo(int val) { // (val & d) implies (val & b) an