Question
I can only use integers constants 0 through 255 (0xFF), inclusive. You are not allowed to use big constants such as 0xffffffff, no global variables,unary
I can only use integers constants 0 through 255 (0xFF), inclusive. You are not allowed to use big constants such as 0xffffffff, no global variables,unary integer operations ! ~, binary integer operations & ^ | + << >>. I can not use any control constructs such as if, do, while, for, switch, etc. Or define or use any macros or define any additional functions in the file or call any functions or use any other operations, such as &&, ||, -, or ?. Nor any form of casting or any data type other than int. This pimples that you cannot use arrays, structs, or unions. The machine uses 2s complement, 32-bit representations of integers, performs right shifts arithmetically, and has unpredictable behavior when shifting if the shift amount is less than 0 or greater than 31. Example of acceptable coding style: /* * pow2plus1 - returns 2^x + 1, where 0 <= x <= 31 */ int pow2plus1(int x){ .* exploit ability of shifts to compute powers of 2 */ return ( 1 << x) +1; } The question on my assignment is "return x -> y in propositional logic - 0 for false, 1 for true.(->) is called implication in propositional logic A -> B is false when A is true and B is false, and it is true in all other cases. The operations I can use are: ! ~ ^ |. I can only use a maximum of 4 operations function outline: int function_name(int x, int y){ return 2; } example: function_name(1,1) = 1; function_name(1,0) = 0
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started