Okay so I’m going through a book CS:APP.

I’m in chapter 2. And problem 2.13 talks about how the Digital Equipment VAX computer used bis (bit set) and bic (bit clear) instead of Boolean operations AND and OR.

Both instructions take a data word x and a mask word m. They generate a result z consisting of the bits x modified according to the bits of m. With bis, the modification involves setting z to 1 at each position where m is 1. With bic, the modification involves setting z to 0 at each position where m is 1.

Now you’re given x and y. And you’re allowed to use bis and bic to recreate x | y. And x ^ y.

Now I have already tried looking at the answers to understand what’s going on. But I don’t understand it.

If I literally look at explaination for bis and bic I would say bis just copies the mask and leaves x unused. And for bic it goes opposite of m, but also without using x. If I try to interpret it differently I end up with questions like what does bic do (for example) when m is 0?

The answers are for x | y: bis(x, y) where y becomes m… so a relatively simple answer.

And for x ^ y (xor): bis(bic(x, y), bic(y, x)) where y and then x becomes m

So basically anything that could clarify what’s going on here would be much appreciated!

And aside from this question, I also would like to ask if this is the right place for questions about a specific CS book? Because I’m teaching myself and don’t have a teacher or someone to ask questions to and seeing with the previous exercise I also had a question it’s possible that I might get a lot. But I can’t find anything when searching on CS:APP (Computer Systems: A Programmer’s Perspective) and yeah don’t know where else to turn to. The book was recommended through teachyourselfcs.com if anyone was wondering.