

Hi all, could anyone explain to me what bitwise is please? I have no idea what it is and I have searched online about it but can't find anything about it and I'm struggling to do the ALU part of the course without it! Thank you :)

Administrator

Bitwise means one bit at a time. For example, bitwise And means that each bit position in the operands is treated independently, i.e., like the And16 you built in chapter 1.
Mark


Thank you for your reply, I understand it a bit better now. I know it may be a silly question but why it is used?, I don't understand why


A basic case is for boolean logic. Other cases include bitmasks and a variety of other "clever" use cases. Can you look online to discover more?


In other words, bitwise negation is logical negation (!) while arithmetic negation is, well, arithmetic negation ().


thank you for replying! I don't get the difference between normal AND and bitwise AND?


For Hack, you can think of them as being the same.

