473,888 Members | 1,294 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

reverse all the bits in a unsigned integer

.. How to reverse all the bits in a unsigned integer? an signed
integer (you have to keep the sign of the integer)?

Mar 22 '07 #1
6 3120
* hijkl:
. How to reverse all the bits in a unsigned integer? an signed
integer (you have to keep the sign of the integer)?
Check out the FAQ's solutions to homework problems.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Mar 22 '07 #2
On Mar 21, 7:06 pm, "Alf P. Steinbach" <a...@start.now rote:
* hijkl:
. How to reverse all the bits in a unsigned integer? an signed
integer (you have to keep the sign of the integer)?

Check out the FAQ's solutions to homework problems.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Hi Alf,
what is that?? i didnt get you :)

Mar 22 '07 #3

"hijkl" <s_******@yahoo .comwrote in message
news:11******** **************@ p15g2000hsd.goo glegroups.com.. .
On Mar 21, 7:06 pm, "Alf P. Steinbach" <a...@start.now rote:
>* hijkl:
. How to reverse all the bits in a unsigned integer? an signed
integer (you have to keep the sign of the integer)?

Check out the FAQ's solutions to homework problems.

Hi Alf,
what is that?? i didnt get you :)
Alf is saying we won't do your homework for you. However, I will point you
in the right direction. If you want to reverse the bits, look at xor
(exclusive or).
Mar 22 '07 #4
On Mar 22, 11:01 am, "hijkl" <s_mah...@yahoo .comwrote:
. How to reverse all the bits in a unsigned integer? an signed
integer (you have to keep the sign of the integer)?
Learn yourself abuot bitwise operators. :)

Mar 22 '07 #5
On Mar 21, 7:33 pm, "Sarath" <CSar...@gmail. comwrote:
On Mar 22, 11:01 am, "hijkl" <s_mah...@yahoo .comwrote:
. How to reverse all the bits in a unsigned integer? an signed
integer (you have to keep the sign of the integer)?

Learn yourself abuot bitwise operators. :)
hey guys
this is not homework questions :) ..
i was preparing for interview. i founf these questions on net :)
here is a link
http://www.aceemploymentservices.net...ions.htm#think
and some other links..
i am done with studies guys
ok have a fun

Mar 22 '07 #6
On 22 Mar, 06:47, "hijkl" <s_mah...@yahoo .comwrote:
On Mar 21, 7:33 pm, "Sarath" <CSar...@gmail. comwrote:
On Mar 22, 11:01 am, "hijkl" <s_mah...@yahoo .comwrote:
. How to reverse all the bits in a unsigned integer? an signed
integer (you have to keep the sign of the integer)?
Learn yourself abuot bitwise operators. :)

hey guys
this is not homework questions :) ..
i was preparing for interview. i founf these questions on net :)
here is a linkhttp://www.aceemployme ntservices.net/Articles/Interviewers/Microsoft%...
and some other links..
We define homework as anything where you want other people to solve or
figure out simple things for you.

--
Erik Wikström

Mar 22 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

47
16602
by: Kapil Khosla | last post by:
Hi, I am trying to reverse a byte eg. 11010000 should look like 00001011 Plz note, it is not a homework problem and I do not need the c code for it. Just give me an idea how should I proceed about it. I know basic bit manipulation , shifting left, right and have done
7
2285
by: Digital Puer | last post by:
I'd like to be able to create an integer from a range of contiguous bits in another integer. I'm on a big-ending machine, in case that matters. I would ideally like to create a function with this prototype: unsigned long long extractValue(unsigned long long target, int a, int b) where a and b are the range of bits counted off from the most significant
40
2206
by: Allan M. Bruce | last post by:
I am applying for my first jobs after completing my PhD. I have been asked by a company to go and take a C programming test to see how my C skills are. Apparantly this test is mostly finding errors in small snippets of code but I was wondering if anyone could give me tips on what kind of things I should be looking out for. The one area I dont feel confident in is how to declare arrays of pointers and initialising multi-dimensional arrays....
13
2096
by: Tomás | last post by:
The quantity of bits used by an unsigned integer type in memory can be determined by: typedef unsigned long long UIntType; CHAR_BIT * sizeof(UIntType) However, what would be a good portable way to determine how many of these
12
2274
by: Frederick Gotham | last post by:
Over on comp.lang.c, Hallvard B Furuseth devised a compile-time constant representing the amount of value representation bits in an unsigned integer type. In true C fashion, here it is as a macro: /* Number of bits in inttype_MAX, or in any (1<<k)-1 where 0 <= k < 3.2E+ 10 */ #define IMAX_BITS(m) ((m) /((m)%0x3fffffffL+1) /0x3fffffffL %0x3fffffffL *30 \ + (m)%0x3fffffffL /((m)%31+1)/31%31*5 + 4-12/((m)%
34
11348
by: Cuthbert | last post by:
Hi folks, I am trying to find a more efficient way to count "How many bits are '1' in a integer variable?". I still have no idea to count the bits except using a loop and "if" statements. Could you know any other more efficient way? Cuthbert
20
19821
by: mike7411 | last post by:
Is there any easy way to reverse the order of the bits in a byte in C++? (i.e. 00000001 becomes 10000000)
40
36522
by: KG | last post by:
Could any one tell me how to reverse the bits in an interger?
25
4576
by: Daniel Kraft | last post by:
Hi, I do need to implement something similar to C++'s std::bitset in C; for this, I use an array of int's to get together any desired number of bits, possibly larger than 32/64 or anything like this. So of course it does not matter how many bits a single int has, but I do need a reliable way to find it out. I think of something like
0
9961
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9802
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11186
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10780
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10887
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9597
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5825
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4642
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4248
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.