Thread: multiplication using bit operation

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Mar 2007
    Posts
    25

    multiplication using bit operation

    Hi

    If I need to multiply a number by 2, I can left shift the number by 1 bit.
    because shifting left by n bits on a signed or unsigned binary number
    has the effect of multiplying it by 2^n (base 2 and power n).
    Now if I want to multiple by 3, how can write a C program using bit operations.

    please comment

    thanks & regards
    Onebrother
    Last edited by onebrother; 02-21-2008 at 04:58 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. 32 bit to 64 bit Ubuntu
    By Akkernight in forum Tech Board
    Replies: 15
    Last Post: 11-17-2008, 03:14 AM
  2. hexadecimal bit operation
    By vlrk in forum C Programming
    Replies: 2
    Last Post: 10-17-2008, 10:04 AM
  3. Replies: 7
    Last Post: 12-10-2004, 08:18 AM
  4. 32 bit floating point multiplication
    By HelpMePlease in forum C Programming
    Replies: 1
    Last Post: 11-30-2004, 08:39 AM
  5. Array of boolean
    By DMaxJ in forum C++ Programming
    Replies: 11
    Last Post: 10-25-2001, 11:45 PM