home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.bbs.mystic      Mystic Sysops are mystical nerds...      11,842 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 10,449 of 11,842   
   g00r00 to All   
   Re: MPL Bitwise Operators   
   13 Jan 22 12:25:44   
   
   From: nospam.g00r00@f215.n129.z1.fidonet.org   
      
    LW> Is someone able to clarify as to how bitwise operators are implemented   
    LW> in MPL?   
    LW>   
    LW> For example: the expression "a := b xor c;" currently returns "Unknown   
    LW> identifier: xor"' during compilation.   
      
   MPL is supposed to support your typical bitwise operators (keywords   
   and/or/xor/shl/shr) but clearly something is not working.   
      
   There are also three functions that allow you to check, set, and toggle bits in   
   any integer type that MPL supports which can be used for now until I figure out   
   what happened.   
      
   This is in a WHATSNEW from way back in 2011 (The number you pass is the actual   
   bit you want to check, set or toggle ie 1-32)   
      
    + New MPL function "BitCheck" accepts a bit position and checks it against   
      an integer, returning true or false if the bit is on.  So for example in   
      the Records, the third bit in UserFlags is UserDeleted:   
      
        GetThisUser   
        If BitCheck(3, UserFlags) Then WriteLn('User is marked deleted');   
      
      Note that this was implemented before actual bitwise math, which also   
      made it into this version.  Keep reading! :)   
      
    + New MPL function "BitToggle" accepts a bit position and an integer and   
      toggles the bit.   
      
        GetThisUser   
        BitToggle(3, UserFlags);  // undeletes if they are deleted or deletes if   
                                  // they are not deleted.   
      
    + New MPL function "BitSet" accepts a bit position and an integer and sets   
      the bit ON/OFF based on a boolean:   
      
        GetThisUser   
        BitSet(3, UserFlags, True);  // user is marked as deleted   
      
   ... What do you mean, QWK? It took me over an hour to read!   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca