Study guides

☆☆

Q: How to Reverse a hexadecimal number using bitwise?

Write your answer...

Submit

Still have questions?

Continue Learning about Engineering

This is not a question.

apple

22 XOR 35 = 53Note that the value 22 is a magic number because it only works for the values 35 and 53. The value 22 was calculated as follows:35 XOR 53 = 22It can also be seen that:22 XOR 53 = 35It is assumed that you are actually looking for some bitwise operation that will reverse the digits in any number. You cannot do this because in order to determine the magic number for any given value, you first need to XOR the value with the reverse of the value, which means you must already know the reverse of the value.To reverse any value that is not a multiple of 10, use the following function:unsigned reverse (unsigned num) {unsigned rev;rev = 0;while (num) {rev *= 10;rev += num % 10;num /= 10;}return rev;}Note that reverse(10) is 1, not 01. If you want to convert trailing zeroes into leading zeroes, convert the number to a string and then reverse the string, returning the string rather than the numeric value.

To swap two numbers without using a temporary variable, use the bitwise exclusive or function... A^=B; B^=A; A^=B;

hexadecimal can express 16 bit binary in 4 place form, not 16.

Related questions

The hexadecimal number system is one using 16 as the base instead of the more familiar ten which we use in the decimal system.

The hexadecimal number system is one using 16 as the base instead of the more familiar ten which we use in the decimal system.

The answer is 15.

num1 <<= 1; /* shift left */

This is not a question.

13 = D in hex. If you're using two digits to represent the hex number - its 0D

The steps for using a free reverse phone number lookup are: go to a website like Reverse Number Direct, type in the relevant information and then you'll get results.

An individual can find a phone number using a reverse directory by inputting the phone number in the space provided in the reverse directory and pressing enter. This will produce the desired results if the phone number is not an unlisted number.

apple

22 XOR 35 = 53Note that the value 22 is a magic number because it only works for the values 35 and 53. The value 22 was calculated as follows:35 XOR 53 = 22It can also be seen that:22 XOR 53 = 35It is assumed that you are actually looking for some bitwise operation that will reverse the digits in any number. You cannot do this because in order to determine the magic number for any given value, you first need to XOR the value with the reverse of the value, which means you must already know the reverse of the value.To reverse any value that is not a multiple of 10, use the following function:unsigned reverse (unsigned num) {unsigned rev;rev = 0;while (num) {rev *= 10;rev += num % 10;num /= 10;}return rev;}Note that reverse(10) is 1, not 01. If you want to convert trailing zeroes into leading zeroes, convert the number to a string and then reverse the string, returning the string rather than the numeric value.

It is a representation of numbers using 16 as the base.

To swap two numbers without using a temporary variable, use the bitwise exclusive or function... A^=B; B^=A; A^=B;

People also asked