The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
bitwise and if Puntino High Level Programming 3 04-28-2008 10:22 AM
If with set operators Khoomfire UNIX for Advanced & Expert Users 2 04-25-2008 08:03 AM
Bitwise negation dLloydm Shell Programming and Scripting 3 05-17-2007 10:57 AM
resetting counter using bitwise XOR mrgubbala High Level Programming 1 09-14-2006 01:58 AM
Bit-fields and Bitwise operators amatsaka High Level Programming 3 04-23-2002 05:13 AM

Closed Thread
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-01-2006
Registered User
 

Join Date: Jul 2006
Posts: 27
bitwise operators

can anybody write a program to divide a number by another number using bitwise operators
Forum Sponsor
  #2 (permalink)  
Old 08-01-2006
blowtorch's Avatar
Supporter
 
Join Date: Dec 2004
Location: Singapore
Posts: 2,323
Probably. What about it?
  #3 (permalink)  
Old 08-01-2006
Registered User
 

Join Date: Jul 2006
Posts: 27
sorry

but i am not getting the logic to divide a number by another number using bitwise operators?? can anybody explain the logic
  #4 (permalink)  
Old 08-01-2006
Registered User
 

Join Date: Jul 2006
Posts: 27
bitwise operators

Can anybody explain the logic of dividing a number by another number using bitwise operators...
  #5 (permalink)  
Old 08-01-2006
vino's Avatar
Supporter (in vino veritas)
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,643
Quote:
Originally Posted by areef4u
Can anybody explain the logic of dividing a number by another number using bitwise operators...
areef4u, please dont bump up posts. I have merged your threads.
  #6 (permalink)  
Old 08-01-2006
tayyabq8's Avatar
UNIX Hobbyist
 

Join Date: Nov 2004
Location: /World/Asia/MiddleEast/Kuwait/Salmiya
Posts: 513
Following will show you bitwise And & , OR | and XOR ^ operations, And & will copy a bit to the result if it exists in both operands:
Code:
main()
  {
                                      /* Binary Values */
    unsigned int a = 60;	/* 60 = 0011 1100 */  
    unsigned int b = 13;	/* 13 = 0000 1101 */
    unsigned int c = 0;           

    c = a & b;                  /* 12 = 0000 1100 */ 
  }
OR | will copy a bit if it exists in eather operand:
Code:
main()
  {
                                      /* Binary Values */
    unsigned int a = 60;	/* 60 = 0011 1100 */  
    unsigned int b = 13;	/* 13 = 0000 1101 */
    unsigned int c = 0;           

    c = a | b;                  /* 61 = 0011 1101 */ 
  }
XOR ^ copies the bit if it is set in one operand (but not both)
Code:
main()
  {
                                        /* Binary Values */
    unsigned int a = 60;	/* 60 = 0011 1100 */  
    unsigned int b = 13;	/* 13 = 0000 1101 */
    unsigned int c = 0;           

    c = a ^ b;                  /* 49 = 0011 0001 */ 
  }
  #7 (permalink)  
Old 08-02-2006
Registered User
 

Join Date: Jul 2006
Posts: 27
i want

i want to know the logic, of this example 15/3 = 5, or 16/3 = 5, using bitwise operators. like dividing two numbers using bitwise operators..
i hope u got it.
Google UNIX.COM
Closed Thread

« testing | Unix »
Thread Tools
Display Modes




All times are GMT -7. The time now is 06:11 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0