Question about software

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Question about software

Yuri
How useful is the AND feature of the ALU to you programmers? I can't think of a useful situation for it so I want to remove it from the ALU for performance.
Reply | Threaded
Open this post in threaded view
|

Re: Question about software

cadet1620
Administrator
Yuri wrote
How useful is the AND feature of the ALU to you programmers? I can't think of a useful situation for it so I want to remove it from the ALU for performance.
The AND feature is used to compute the logical functions that support logical expressions in high-level languages.  For example if a and b are logical conditions, your program might want to test that a is true and b is false.  The program would use "if (a & !b)" to test that condition.

AND and OR are also very useful for testing, setting and resetting bits within numeric values.  For instance, "(a & 1)" will test if a number is odd.

Most programs do far more logical operations than arithmetic operations.

--Mark