User Tag List

Results 1 to 6 of 6

Thread: Turning on/ off Bits

  1. #1
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    King_Cool's Avatar
    Join Date
    Aug 2008
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Turning on/ off Bits

    I know about adding 1/ 2/ 4/ 8/ 16/ 32 etc to AltValue to turn on Bits, but if i turn on the same bit 2 times in a row ( without reseting the AltValue to 0 ) that system fails
    ...
    How can i turn on/ off a specific Bit of an Alterable Value?

  2. #2
    Forum Moderator Fusion 2.5 DeveloperHTML5 Export ModuleiOS Export ModuleSWF Export Module
    DavidN's Avatar
    Join Date
    Jun 2006
    Location
    Boston, MA, USA
    Posts
    4,044
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use the OR, AND and XOR operators - these act on the binary representation of the number.

    If you had "bits" 4, 8 and 32 on, your current number is 44, the binary for which is 101100.

    To turn on bit 16 as well, use 44 OR 16:

    44 OR 16 = 101100 OR 010000 = 111100 = 60

    Turning on existing bits again will not affect the number...

    60 OR 16 = 111100 OR 010000 = Still 60

    And, er, I can't quite remember how to turn specific bits off using this system while leaving other bits alone. Perhaps someone else can step in!

  3. #3
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    King_Cool's Avatar
    Join Date
    Aug 2008
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you DavidN
    Theese bit operations are really usefull

  4. #4
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleXNA Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    gkinfinity's Avatar
    Join Date
    May 2011
    Location
    USA
    Posts
    284
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I haven't done this recently and I've never actually done anything regarding bits in mmf2, but as I recall you just use OR to add bits, AND to subtract bits, and XOR to toggle bits.

    ____10111111
    And 11110001
    __= 10110001 1s are only kept at the bit locations that have 1s in both cases (for the top and bottom number)

  5. #5
    Clickteam Clickteam
    LB's Avatar
    Join Date
    Jun 2007
    Location
    Richardson, Texas, North America
    Posts
    8,937
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    You can use:
    ExpressionA AND (NOT ExpressionB)
    To turn off the bits in ExpressionA that are on in ExpressionB
    Working as fast as I can on Fusion 3

  6. #6
    Clicker Multimedia Fusion 2SWF Export Module
    Jacob's Avatar
    Join Date
    Jul 2007
    Location
    Second pixel to the right
    Posts
    3,208
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by DavidN View Post
    And, er, I can't quite remember how to turn specific bits off using this system while leaving other bits alone. Perhaps someone else can step in!
    Use XOR.

    60 XOR 16 = 111100 XOR 010000 = 44

Similar Threads

  1. Control over the bits within a byte?
    By CrazyMLC in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 8th October 2012, 01:43 PM
  2. Blowfish bits
    By Tricolete in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 9th September 2010, 03:05 PM
  3. Windows Xp 64 bits
    By waw_demmon in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 21st August 2008, 07:27 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •