Bit Set
Bit Set

How can I shift a set of bits 1 bit to the right if I can only manipulate the bits by using addition and nand?
I'm tasked with dividing a number by 2, which I know you can do by shifting the bits 1 to the right. The problem is, the set of assembly language instructions I've been given do not include divide or shift.
Basically, all I can do is use ADD or NAND.
If anyone can explain how to accomplish division by 2 using NAND instruction and ADD instruction, I would be very grateful.
Use NAND to discover what bits are set in your number.
You aren't allowed to shift, but you can build the equivalent shifted number:
011100
shift right one is
001110
So OK, we can't shift, but we can build the second number, bit by bit by ADDing, can't we?
General rule of a right shift: We know the 2nd bit in the 1st number will become the 1st bit in the 2nd number.... 3rd bit becomes 2nd, 4th becomes 3rd....yadda, yadda, yadda.
So, use NAND to discover the bits in the original number, then build the new number one ADD at time.
![]() |
![]() VINTAGE GILPINS CANNOCK 8 PIECE DRILL BIT SET US $71.13
|
![]() 10p WOOD SPADE DRILL BIT SET with BIT 12 EXTENSION New US $17.99
|
![]() Mobile Phone PDA Screwdriver Bits Plastic Handle Nipper Tool Set US $.97
|
![]() NEW Craftsman Tools 5 piece 1 4 inch drive hex bit socket set US $4.99
|
![]() NEW Craftsman USA 3 8 Drive Bit Sockets 3 Piece Set US $6.99
|
![]() NEW Craftsman USA 3 8 Drive Bit Sockets 4 Piece Set US $8.49
|
![]() 13PC 1 4 Hex Shank Titanium Coated Drill Bit Set Metal Durable High Speed US $12.15
|
| Powered by phpBay Pro |
'Fortress Toronto' set for G20
Leave a Reply
You must be logged in to post a comment.


US $17.99







































