Advertisement
Peaser

binaryadders

Mar 18th, 2015
335
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.17 KB | None | 0 0
  1. def adder(a, b, c_in):
  2.     half = lambda a, b: a^b, a&b
  3.     xor1 = a^b
  4.     xor2 = xor1^c_in
  5.     and1 = xor1&c_in
  6.     and2 = a&b
  7.     cOut = and1|and2
  8.     return xor2, cOut
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement