Skip to content

Instantly share code, notes, and snippets.

@woodsleaf
Last active April 10, 2018 05:40
Show Gist options
  • Select an option

  • Save woodsleaf/29786d24987053d5087345848eec523f to your computer and use it in GitHub Desktop.

Select an option

Save woodsleaf/29786d24987053d5087345848eec523f to your computer and use it in GitHub Desktop.

Revisions

  1. woodsleaf revised this gist Apr 10, 2018. 1 changed file with 7 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion turnon.py
    Original file line number Diff line number Diff line change
    @@ -6,4 +6,10 @@ def turnon(a):
    return desired

    a = 0b10111011
    print(bin(turnon(a)))
    print(bin(turnon(a)))

    #flip
    #a = 0b11101110
    #mask = 0b11111111
    #desired = a ^ mask
    #print(bin(desired))
  2. woodsleaf created this gist Apr 10, 2018.
    9 changes: 9 additions & 0 deletions turnon.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    def turnon(a):
    mask = 0b100
    desired = a | mask
    # print(bin(desired))
    # if a != desired:
    return desired

    a = 0b10111011
    print(bin(turnon(a)))