Announcement

Collapse
No announcement yet.

what is the best way to translate "&=~" in pb?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • what is the best way to translate "&=~" in pb?

    Hey,

    what is the best way to translate this into PB code

    for instance
    const bar = 12;

    int foo;

    foo &=~ bar;

    as I read it, it is "anding" the ones compliment of bar?

    thanks for any help!!
    Sr. Software Development Engineer and Sr. Information Security Analyst,
    CEH, Digital Forensic Examiner

  • #2
    You'd use "And Not". For example, in C/C++:

    Code:
    DWORD dwFooBar = 0x10030;
    
    dwFooBar &= ~0x20; // dwFooBar is now 0x10010
    The equivalent in PowerBasic would be:

    Code:
    Dim dwFooBar As DWORD
    
    dwFooBar = &H10030
    dwFooBar = dwFooBar And (Not &H20)
    Mike Stefanik
    sockettools.com

    Comment


    • #3
      Brain not working - post deleted..
      Last edited by Borje Hagsten; 8 May 2013, 04:07 AM.

      Comment


      • #4
        Thats what i was thinking and ended up with the same thing...

        Thanks!!
        Sr. Software Development Engineer and Sr. Information Security Analyst,
        CEH, Digital Forensic Examiner

        Comment


        • #5
          Originally posted by Mike Stefanik View Post
          ...
          The equivalent in PowerBasic would be:

          Code:
          Dim dwFooBar As DWORD
          
          dwFooBar = &H10030
          dwFooBar = dwFooBar And (Not &H20)
          PB also "let"'s you use:

          dwFooBar AND= Not &H20

          See Let statement in the docs.
          Bernard Ertl
          InterPlan Systems

          Comment

          Working...
          X