Interchange 2 nibbles of byte

Discussion in 'C++' started by Sreejith K, Nov 14, 2003.

  1. Sreejith K

    Sreejith K Guest

    How to interchange the two nibbles of a byte without
    using any bitwise operator.
    Sreejith K, Nov 14, 2003
    #1
    1. Advertising

  2. Sreejith K

    Lasse Skyum Guest

    unsigned char a;
    a = a * 16 + a/16;

    But why would you want to do that?? What kind of system doesn't have bitwise
    operators?

    --
    Lasse
    Lasse Skyum, Nov 14, 2003
    #2
    1. Advertising

  3. Sreejith K

    Megan Guest

    On Fri, 14 Nov 2003 08:08:18 +0100, "Lasse Skyum" <no spam> wrote:

    >unsigned char a;
    >a = a * 16 + a/16;
    >
    >But why would you want to do that?? What kind of system doesn't have bitwise
    >operators?


    Can you say homework assignment?
    M
    Megan, Nov 14, 2003
    #3
  4. Sreejith K

    Lasse Skyum Guest

    > Can you say homework assignment?

    ahh, right...
    Lasse Skyum, Nov 14, 2003
    #4
  5. Sreejith K

    aks Guest

    nop i suppose it's the question asked in interviews ;)

    Lasse Skyum wrote:
    >
    > unsigned char a;
    > a = a * 16 + a/16;
    >
    > But why would you want to do that?? What kind of system doesn't have bitwise
    > operators?
    >
    > --
    > Lasse
    aks, Nov 14, 2003
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. WideBoy
    Replies:
    0
    Views:
    470
    WideBoy
    Jan 4, 2006
  2. Bernhard Hidding

    gnuplot parameter interchange

    Bernhard Hidding, Jun 25, 2004, in forum: C++
    Replies:
    3
    Views:
    1,095
    Karl Heinz Buchegger
    Jun 25, 2004
  3. Edward Rutherford

    Type interchange

    Edward Rutherford, Nov 30, 2011, in forum: C Programming
    Replies:
    35
    Views:
    672
    Tim Rentsch
    Jan 25, 2012
  4. daniel åkerud

    To and from hex nibbles

    daniel åkerud, Jun 10, 2008, in forum: Ruby
    Replies:
    2
    Views:
    113
    Peña, Botp
    Jun 10, 2008
  5. 88888 Dihedral
    Replies:
    4
    Views:
    569
    88888 Dihedral
    Feb 28, 2012
Loading...

Share This Page