Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Trouble with bitwise operations
Index -> General Programming
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
JimmTheDog




PostPosted: Sat Nov 21, 2009 2:33 am   Post subject: Trouble with bitwise operations

I'm having some trouble with logical operations on bit patterns, especially when it comes to writing "procedures." It's hard for my mind to get that close to computer architecture. Does anyone have a sort of process for this? I'll use an example from my textbook (I already know the answer... just how to get there screwed me up)

"If n and m are both 4-bit 2's complement numbers, and s is the 4-bit result of adding them together, how can we determine, using only the operations AND, OR, NOT, and XOR, if an overflow occurred during the addition? Develop a "procedure" for doing so. The inputs to the procedure are n, m, and s, and the output will be a bit pattern of all zeros (0000) if no overflow occurred and 1000 if an overflow did occur."

Any help would be much appreciated.
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> General Programming
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 1 Posts ]
Jump to:   


Style:  
Search: