# Bit twidling

Write a C function to compute xn which uses minimum number of multiplications. unsigned int power(double x, unsigned int n)

Given an unsigned int n, find the integer greater than or equal to n which is a power of 2. For example: Input Output —– —— 6 8 12 16 64 64

Write a function that accepts two unsigned int and return sum of these two integers. The function should not use any arithmetic operator (mayuse bitwise operators only).

Given two unsigned integers, find the larger (or smaller) of the two without using branching (if-else or conditional operator).

Given an Array of two elements one of which is 0, the other is either 0 or 1. You have to make both the elements of array 0. But following are the constraints:

How will you check if a number if a power of two or not? For example: 4, 8, 1024 etc are powers of two. But 6, 40, 95 etc are not

Give a method to find whether an integer is a power of 4 or not.

How will you turn off the rightmost bit in the binary representation of an unsigned int number.

Given 2 unsigned integers, write expressions to find the maximum and minimum of these 2 integers without using either if-else or conditional operator.