5 ms·
In the accompanying video[0] at 7:36 mark, he goes to great lengths to express (A or B) as (A and B) + (A xor B). Can anybody explain why it can't simply be ex
by asalahli 4y ago
In the accompanying video[0] at 7:36 mark, he goes to great lengths to express (A or B) as (A and B) + (A xor B).
Can anybody explain why it can't simply be expressed as (A and B) xor (A xor B)? What am I missing here?
0. https://www.youtube.com/embed/LA_DrBwkiJA https://www.youtube.com/embed/LA_DrBwkiJA
- dzaima 4y agoit can, as was discussed in comments on the video with replies from Tom. IIRC, the source code has been updated to use that instead.
- rep_lodsb 4y agoWhether you add or xor will make no difference since there will never be two bits set in the same position. The key point is that printable ASCII limits what operations are available, so you have to synthesize some of them.
- asalahli 4y agoThe difference is that xor is available to him (he mentions that in the video), while addition needs to be achieved by combining multiple instructions.