Re: bitwise operation doesn't work, what am I doing wrong?



MikyMike wrote:

Oh My God! Sorry Rob and Terry, I just saw the problem, you're true I
can't verify the DT_LEFT since it's zero. I must verify the other
ones, then if the others are not set, them assume it's DT_LEFT.

Thank-you :)

On Thu, 28 Dec 2006 15:40:07 +1030, "Terry Russell"
<trochilus@xxxxxxxxxxxxxxxxxxxxx> wrote:


"MikyMike" <abcdef70@xxxxxxxxxxx> wrote in message news:l7h6p2h3nh5vaqe4gtmh2s8igragums324@xxxxxxxxxx

Thank-you, even if what you said was also important, it didn't solve
my problem.
___________

On Wed, 27 Dec 2006 21:56:56 -0600, Rob Kennedy <me3@xxxxxxxxxxx>
wrote:


MikyMike wrote:

Hi, I try to do a bitwise operation to see if Alignment containt
DT_LEFT, but it always return false. Anyone have an idea why this
doesn't work?

I've already answered you in another newsgroup.

dt_left is dt_top is the default zero value

the problem is with your expectation that dt_left signifies a bit position to be set
and operated on
it is all bits zero not any one bit set, it is the empty set
test the doughnut hole all you like, it will not tell you anything about the dough



Just do this.
If (Alignment and DT_LEFT) = DT_LEFT then.....
that will mask out all other bits leaving behind only
the one you're looking for.
if it happens to be a zero value, that's fine, it will
still work this way because comparing 0 with 0 will = true.



--
"I'm never wrong, once i thought i was, but was mistaken"
Real Programmers Do things like this.
http://webpages.charter.net/jamie_5

.



Relevant Pages

  • Re: *nix advice for assignment
    ... > verify the commands I have written below. ... How can you tell if a command successfully completed? ... but quits when a zero is found. ... An 'if' construct may be part of the shell script you are requested ...
    (comp.unix.shell)
  • Re: Converting negative integer to octal/hexadecimal
    ... verify the sum is zero. ... They never stop thinking about new ways to harm our country ...
    (comp.lang.c)
  • Re: *nix advice for assignment
    ... > verify the commands I have written below. ... How can you tell if a command successfully completed? ... but quits when a zero is found. ... echo out that it is exiting because the zero was ...
    (comp.unix.shell)
  • Re: FLTMA: Verification of "large zero"
    ... > from Hanford Carr) one might well wonder where Doug Goncz dreamt up ... I wasn't looking at cubic exponent residues at all. ... In this case Shas a zero S.546. ... Can anyone here verify as expected that ...
    (sci.math)
  • Re: bitwise operation doesnt work, why?
    ... MikyMike wrote: ... verify the DT_LEFT since it's zero. ... This seems to be the only multi-bit field in this parameter, all other values are 2^n. ...
    (comp.lang.pascal.delphi.misc)