bytes: shifting doubles?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Allan Rydberg

    bytes: shifting doubles?


    hi

    i'm trying to shift a double, but i'm getting the
    error message '>>' illegal, left operand double.

    althought that the manpages say, '>>' and '<<' can
    be applied for int's only, i was able to use the
    shift operator on unsigned longs without any problems.
    does anyone know how to do this properly?

    i.e. individually copying bytes into a long array:
    --------------------------------
    int pointer;
    char databuffer[100];

    double uint64;
    unsigned long uint32;

    pointer =0;

    // this works:
    uint32 = 1111111; // anything
    databuffer[pointer++] = uint32 >> 24;
    databuffer[pointer++] = uint32 >> 16;
    databuffer[pointer++] = uint32 >> 8;
    databuffer[pointer++] = uint32 >> 0; // jup, i know..!

    // this won't:
    uint64 = 1111111; // anything
    databuffer[pointer++] = uint64 >> 56;
    databuffer[pointer++] = uint64 >> 48;
    databuffer[pointer++] = uint64 >> 40;
    databuffer[pointer++] = uint64 >> 32;
    databuffer[pointer++] = uint64 >> 24;
    databuffer[pointer++] = uint64 >> 16;
    databuffer[pointer++] = uint64 >> 8;
    databuffer[pointer++] = uint64 >> 0;



    [ See http://www.gotw.ca/resources/clcm.htm for info about ]
    [ comp.lang.c++.m oderated. First time posters: Do this! ]

  • Johncarp

    #2
    Re: bytes: shifting doubles?

    Allan Rydberg wrote:[color=blue]
    > hi
    >
    > i'm trying to shift a double, but i'm getting the
    > error message '>>' illegal, left operand double.
    >
    > althought that the manpages say, '>>' and '<<' can
    > be applied for int's only, i was able to use the
    > shift operator on unsigned longs without any problems.
    > does anyone know how to do this properly?
    >
    > i.e. individually copying bytes into a long array:
    > --------------------------------
    > int pointer;
    > char databuffer[100];
    >
    > double uint64;
    > unsigned long uint32;
    >
    > pointer =0;
    >
    > // this works:
    > uint32 = 1111111; // anything
    > databuffer[pointer++] = uint32 >> 24;
    > databuffer[pointer++] = uint32 >> 16;
    > databuffer[pointer++] = uint32 >> 8;
    > databuffer[pointer++] = uint32 >> 0; // jup, i know..!
    >
    > // this won't:
    > uint64 = 1111111; // anything
    > databuffer[pointer++] = uint64 >> 56;
    > databuffer[pointer++] = uint64 >> 48;
    > databuffer[pointer++] = uint64 >> 40;
    > databuffer[pointer++] = uint64 >> 32;
    > databuffer[pointer++] = uint64 >> 24;
    > databuffer[pointer++] = uint64 >> 16;
    > databuffer[pointer++] = uint64 >> 8;
    > databuffer[pointer++] = uint64 >> 0;[/color]

    unsigned long is usually the same as unsigned int, so it works. if you
    want to shift 64bit value, you can use long long under gcc and __int64
    (?) under msvc++.

    [ See http://www.gotw.ca/resources/clcm.htm for info about ]
    [ comp.lang.c++.m oderated. First time posters: Do this! ]

    Comment

    • Kyle

      #3
      Re: bytes: shifting doubles?

      Allan Rydberg wrote:[color=blue]
      > hi
      >
      > i'm trying to shift a double, but i'm getting the
      > error message '>>' illegal, left operand double.
      >
      > althought that the manpages say, '>>' and '<<' can
      > be applied for int's only, i was able to use the
      > shift operator on unsigned longs without any problems.
      > does anyone know how to do this properly?
      >
      > i.e. individually copying bytes into a long array:
      > --------------------------------
      > int pointer;
      > char databuffer[100];
      >
      > double uint64;[/color]

      double is floating point type, not integral type
      shifting with these operators is allowed on integral types only
      (you may want to look for a 64 bit integral type on your platform)

      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.m oderated. First time posters: Do this! ]

      Comment

      • Philippe Amarenco

        #4
        Re: bytes: shifting doubles?

        Allan Rydberg <alrdbg@southte ch.net> writes:
        [color=blue]
        > int pointer;
        > char databuffer[100];
        >
        > double uint64;
        > unsigned long uint32;
        >[/color]

        double is a floating point type.

        --
        Philippe Amarenco, aka Phix
        epita 2007 - LSE - EpX
        "if new true friend not protected for explicit private union, break
        case and try using this." -- Nathan Myers, longest c++ sentence.

        [ See http://www.gotw.ca/resources/clcm.htm for info about ]
        [ comp.lang.c++.m oderated. First time posters: Do this! ]

        Comment

        • robertwessel2@yahoo.com

          #5
          Re: bytes: shifting doubles?


          Allan Rydberg wrote:[color=blue]
          > hi
          >
          > i'm trying to shift a double, but i'm getting the
          > error message '>>' illegal, left operand double.
          >
          > althought that the manpages say, '>>' and '<<' can
          > be applied for int's only, i was able to use the
          > shift operator on unsigned longs without any problems.
          > does anyone know how to do this properly?[/color]


          Longs (and chars and shorts) are all integers. Doubles are floats, and
          you cannot apply the shift operators to them. Just multiply or divide
          by the appropriate power of two instead - instead of "a<<6" do "a*64".


          [ See http://www.gotw.ca/resources/clcm.htm for info about ]
          [ comp.lang.c++.m oderated. First time posters: Do this! ]

          Comment

          • Greg Herlihy

            #6
            Re: bytes: shifting doubles?


            Allan Rydberg wrote:[color=blue]
            > hi
            >
            > i'm trying to shift a double, but i'm getting the
            > error message '>>' illegal, left operand double.
            >
            > althought that the manpages say, '>>' and '<<' can
            > be applied for int's only, i was able to use the
            > shift operator on unsigned longs without any problems.
            > does anyone know how to do this properly?
            >
            > i.e. individually copying bytes into a long array:
            > --------------------------------
            > int pointer;
            > char databuffer[100];
            >
            > double uint64;
            > unsigned long uint32;
            >
            > pointer =0;
            >
            > // this works:
            > uint32 = 1111111; // anything
            > databuffer[pointer++] = uint32 >> 24;
            > databuffer[pointer++] = uint32 >> 16;
            > databuffer[pointer++] = uint32 >> 8;
            > databuffer[pointer++] = uint32 >> 0; // jup, i know..!
            >
            > // this won't:
            > uint64 = 1111111; // anything
            > databuffer[pointer++] = uint64 >> 56;
            > databuffer[pointer++] = uint64 >> 48;[/color]

            A double is a double float. It is not an integer type, so it cannot be
            bit shifted. (It can be divided by a power of 2, of course, but
            presumably the bit patterns and not the values stored in dataBuffer are
            of interest here).

            A long long is an integer type and can be bit shifted.

            So I recommend declaring uint64 like this:

            typedef unsigned long long uint64;

            for the code to compile as written. I would also recommend renaming
            "pointer" since it is not a pointer, but an index.

            Greg


            [ See http://www.gotw.ca/resources/clcm.htm for info about ]
            [ comp.lang.c++.m oderated. First time posters: Do this! ]

            Comment

            • Nick Keighley

              #7
              Re: bytes: shifting doubles?

              Allan Rydberg wrote:
              [color=blue]
              > i'm trying to shift a double, but i'm getting the
              > error message '>>' illegal, left operand double.
              >
              > althought that the manpages say, '>>' and '<<' can
              > be applied for int's only, i was able to use the
              > shift operator on unsigned longs without any problems.
              > does anyone know how to do this properly?[/color]

              actually the phrase is "...shift operators ... operands shall be
              of integral or enumeration type". unsigned long is integral,
              double is. You can't do this.
              [color=blue]
              > i.e. individually copying bytes into a long array:
              > --------------------------------
              > int pointer;
              > char databuffer[100];[/color]
              unsigned char databuffer[100];
              [color=blue]
              > double uint64;
              > unsigned long uint32;
              >
              > pointer =0;[/color]

              well you could try this:

              unsigned char *p;
              p = (unsigned char*)&uint64; /* that's an odd name for a double...
              */
              for (i = 0; i < sizeof(double); i++)
              databuffer [i] = *p++;

              this trick of copying one type to another via a cast pointer only
              works for unsigned char. Anything else yields undefined behaviour.
              Also note that different implementations may represent doubles
              differently and hence the above code won't put the same thing in
              databuffer.
              [color=blue]
              > // this works:
              > uint32 = 1111111; // anything
              > databuffer[pointer++] = uint32 >> 24;
              > databuffer[pointer++] = uint32 >> 16;
              > databuffer[pointer++] = uint32 >> 8;
              > databuffer[pointer++] = uint32 >> 0; // jup, i know..![/color]

              Undefined Behaviour
              [color=blue]
              > // this won't:
              > uint64 = 1111111; // anything
              > databuffer[pointer++] = uint64 >> 56;
              > databuffer[pointer++] = uint64 >> 48;
              > databuffer[pointer++] = uint64 >> 40;
              > databuffer[pointer++] = uint64 >> 32;
              > databuffer[pointer++] = uint64 >> 24;
              > databuffer[pointer++] = uint64 >> 16;
              > databuffer[pointer++] = uint64 >> 8;
              > databuffer[pointer++] = uint64 >> 0;[/color]


              --
              Nick Keighley

              "There are 10 types of people in this world.
              Those that understand Binary, and those that don't".


              [ See http://www.gotw.ca/resources/clcm.htm for info about ]
              [ comp.lang.c++.m oderated. First time posters: Do this! ]

              Comment

              • CodeCracker

                #8
                Re: bytes: shifting doubles?

                A simple way to do that is to use a union and put both your double and
                a char pointer variable or a char array of size double. Thats it. write
                data in double and read the value from double but when to stream data
                in and out of the char buffer get the data from char poiinter.


                [ See http://www.gotw.ca/resources/clcm.htm for info about ]
                [ comp.lang.c++.m oderated. First time posters: Do this! ]

                Comment

                • Rob

                  #9
                  Re: bytes: shifting doubles?

                  Allan Rydberg wrote:
                  [color=blue]
                  >
                  > hi
                  >
                  > i'm trying to shift a double, but i'm getting the
                  > error message '>>' illegal, left operand double.
                  >
                  > althought that the manpages say, '>>' and '<<' can
                  > be applied for int's only, i was able to use the
                  > shift operator on unsigned longs without any problems.
                  > does anyone know how to do this properly?[/color]

                  You've answered your own question. The basic >> and << operators are
                  only defined to work with integral types.

                  [color=blue]
                  >
                  > i.e. individually copying bytes into a long array:
                  > --------------------------------
                  > int pointer;
                  > char databuffer[100];
                  >
                  > double uint64;
                  > unsigned long uint32;
                  >
                  > pointer =0;
                  >
                  > // this works:
                  > uint32 = 1111111; // anything
                  > databuffer[pointer++] = uint32 >> 24;
                  > databuffer[pointer++] = uint32 >> 16;
                  > databuffer[pointer++] = uint32 >> 8;
                  > databuffer[pointer++] = uint32 >> 0; // jup, i know..!
                  >
                  > // this won't:
                  > uint64 = 1111111; // anything
                  > databuffer[pointer++] = uint64 >> 56;
                  > databuffer[pointer++] = uint64 >> 48;
                  > databuffer[pointer++] = uint64 >> 40;
                  > databuffer[pointer++] = uint64 >> 32;
                  > databuffer[pointer++] = uint64 >> 24;
                  > databuffer[pointer++] = uint64 >> 16;
                  > databuffer[pointer++] = uint64 >> 8;
                  > databuffer[pointer++] = uint64 >> 0;
                  >[/color]

                  If you want access to the bits in the double you might try doing a bit
                  of wizardry with casting of pointers;

                  unsigned long long *address; // double is (typically) longer than a
                  long

                  address = (unsigned long long)(&uint64);

                  databuffer[pointer++] = (*address) >> 56;

                  That will give you access to the bits that (internally) make up the
                  double variable.

                  The value of doing this is .... questionable. You might try
                  specifying what you're *really* trying to achieve by doing this: there
                  is almost certainly a better way to do it.

                  [ See http://www.gotw.ca/resources/clcm.htm for info about ]
                  [ comp.lang.c++.m oderated. First time posters: Do this! ]

                  Comment

                  • James Kanze

                    #10
                    Re: bytes: shifting doubles?

                    Allan Rydberg wrote:
                    [color=blue]
                    > i'm trying to shift a double, but i'm getting the error
                    > message '>>' illegal, left operand double.[/color]
                    [color=blue]
                    > althought that the manpages say, '>>' and '<<' can be applied
                    > for int's only, i was able to use the shift operator on
                    > unsigned longs without any problems.[/color]

                    The operators are defined for all integral types, not just int.
                    But becareful with >> on a signed integral type; I tend to only
                    use it with unsigned types, just to be on the safe side.
                    [color=blue]
                    > does anyone know how to do this properly?[/color]
                    [color=blue]
                    > i.e. individually copying bytes into a long array:
                    > --------------------------------
                    > int pointer;
                    > char databuffer[100];[/color]
                    [color=blue]
                    > double uint64;[/color]

                    Now that's a confusing name.
                    [color=blue]
                    > unsigned long uint32;
                    >
                    > pointer =0;[/color]
                    [color=blue]
                    > // this works:
                    > uint32 = 1111111; // anything
                    > databuffer[pointer++] = uint32 >> 24;
                    > databuffer[pointer++] = uint32 >> 16;
                    > databuffer[pointer++] = uint32 >> 8;
                    > databuffer[pointer++] = uint32 >> 0; // jup, i know..![/color]
                    [color=blue]
                    > // this won't:
                    > uint64 = 1111111; // anything
                    > databuffer[pointer++] = uint64 >> 56;
                    > databuffer[pointer++] = uint64 >> 48;
                    > databuffer[pointer++] = uint64 >> 40;
                    > databuffer[pointer++] = uint64 >> 32;
                    > databuffer[pointer++] = uint64 >> 24;
                    > databuffer[pointer++] = uint64 >> 16;
                    > databuffer[pointer++] = uint64 >> 8;
                    > databuffer[pointer++] = uint64 >> 0;[/color]

                    I suppose that you are formatting binary data for output. And
                    that the specification requires IEEE double, high byte first,
                    and that you accept the fact that your code will not be portable
                    to a machine which doesn't use IEEE floating point (IBM or
                    Unisys mainframe, for example). Given that you don't really
                    have absolute portability anyway, the obvious answer here is to
                    use a reinterpret_cas t, e.g.:

                    double d = 111111 ;
                    unsigned int const& ui
                    = reinterpret_cas t< unsigned int const& >( d ) ;
                    databuffer[ pointer ++ ] = ui >> 56 ;
                    // ...

                    If you require absolute portability, so that the code will run
                    as is even on a Unisys mainframe, you've got your work cut out
                    for you -- you have to functions like frexp to extract the
                    necessary information from the floating point format and create
                    your own IEEE format. But portability to this degree typically
                    isn't necessary.

                    --
                    James Kanze mailto: james.kanze@fre e.fr
                    Conseils en informatique orientée objet/
                    Beratung in objektorientier ter Datenverarbeitu ng
                    9 pl. Pierre Sémard, 78210 St.-Cyr-l'École, France +33 (0)1 30 23 00 34

                    [ See http://www.gotw.ca/resources/clcm.htm for info about ]
                    [ comp.lang.c++.m oderated. First time posters: Do this! ]

                    Comment

                    • Thomas Maeder

                      #11
                      Re: bytes: shifting doubles?

                      Allan Rydberg <alrdbg@southte ch.net> writes:
                      [color=blue]
                      > i'm trying to shift a double, but i'm getting the
                      > error message '>>' illegal, left operand double.[/color]

                      What would you expect as a result of shifting a double?

                      [color=blue]
                      > althought that the manpages say, '>>' and '<<' can
                      > be applied for int's only, i was able to use the
                      > shift operator on unsigned longs without any problems.
                      > does anyone know how to do this properly?[/color]

                      If the man page says that >> and << apply to int only, it's wrong. You
                      can apply them to objects of integral and enumeration types; that
                      includes unsigned long, but not double.

                      [color=blue]
                      > i.e. individually copying bytes into a long array:
                      > --------------------------------
                      > int pointer;
                      > char databuffer[100];
                      >
                      > double uint64;[/color]

                      A very misleading variable name ...

                      [color=blue]
                      > unsigned long uint32;[/color]

                      .... and a platform-dependant variable name.

                      [color=blue]
                      > pointer =0;
                      >
                      > // this works:
                      > uint32 = 1111111; // anything
                      > databuffer[pointer++] = uint32 >> 24;
                      > databuffer[pointer++] = uint32 >> 16;
                      > databuffer[pointer++] = uint32 >> 8;
                      > databuffer[pointer++] = uint32 >> 0; // jup, i know..!
                      >
                      > // this won't:
                      > uint64 = 1111111; // anything
                      > databuffer[pointer++] = uint64 >> 56;[/color]

                      Again: what should the result of evaluating the expression

                      uint64 >> 56

                      be?

                      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
                      [ comp.lang.c++.m oderated. First time posters: Do this! ]

                      Comment

                      • Jack Klein

                        #12
                        Re: bytes: shifting doubles?

                        On 17 Sep 2005 10:00:36 -0400, Allan Rydberg <alrdbg@southte ch.net>
                        wrote in comp.lang.c:
                        [color=blue]
                        >
                        > hi
                        >
                        > i'm trying to shift a double, but i'm getting the
                        > error message '>>' illegal, left operand double.[/color]

                        Why do you think you want to shift a double?
                        [color=blue]
                        > althought that the manpages say, '>>' and '<<' can
                        > be applied for int's only, i was able to use the[/color]

                        Either your man pages are incorrect, or more likely you are quoting
                        them incorrectly. The bitwise right and left shift operators may be
                        applied to all of the integer types, of which int is one. The others
                        are char, short, long, and long long.
                        [color=blue]
                        > shift operator on unsigned longs without any problems.
                        > does anyone know how to do this properly?[/color]

                        How to shift a double properly? No, because it makes no sense either
                        mathematically or in terms of C or C++. What are you really trying to
                        do?
                        [color=blue]
                        > i.e. individually copying bytes into a long array:[/color]

                        Actually, the code in your snippet below attempts to copy bytes into
                        an array of char. Unsigned char would be a better choice.
                        [color=blue]
                        > --------------------------------
                        > int pointer;
                        > char databuffer[100];
                        >
                        > double uint64;
                        > unsigned long uint32;
                        >
                        > pointer =0;
                        >
                        > // this works:
                        > uint32 = 1111111; // anything
                        > databuffer[pointer++] = uint32 >> 24;
                        > databuffer[pointer++] = uint32 >> 16;
                        > databuffer[pointer++] = uint32 >> 8;
                        > databuffer[pointer++] = uint32 >> 0; // jup, i know..!
                        >
                        > // this won't:
                        > uint64 = 1111111; // anything
                        > databuffer[pointer++] = uint64 >> 56;
                        > databuffer[pointer++] = uint64 >> 48;
                        > databuffer[pointer++] = uint64 >> 40;
                        > databuffer[pointer++] = uint64 >> 32;
                        > databuffer[pointer++] = uint64 >> 24;
                        > databuffer[pointer++] = uint64 >> 16;
                        > databuffer[pointer++] = uint64 >> 8;
                        > databuffer[pointer++] = uint64 >> 0;[/color]

                        You could include <string.h> and use memcpy().

                        memcpy(databuff er, &uint64, sizeof(double)) ;

                        --
                        Jack Klein
                        Home: http://JK-Technology.Com
                        FAQs for
                        comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
                        comp.lang.c++ http://www.parashift.com/c++-faq-lite/
                        alt.comp.lang.l earn.c-c++


                        [ See http://www.gotw.ca/resources/clcm.htm for info about ]
                        [ comp.lang.c++.m oderated. First time posters: Do this! ]

                        Comment

                        • Keyser Soze

                          #13
                          Re: bytes: shifting doubles?

                          "Allan Rydberg" <alrdbg@southte ch.net> wrote in message
                          news:dgf286$cj7 $2@news.hispeed .ch...[color=blue]
                          >
                          > hi
                          >
                          > i'm trying to shift a double, but i'm getting the
                          > error message '>>' illegal, left operand double.
                          >
                          > althought that the manpages say, '>>' and '<<' can
                          > be applied for int's only, i was able to use the
                          > shift operator on unsigned longs without any problems.
                          > does anyone know how to do this properly?
                          >
                          > i.e. individually copying bytes into a long array:
                          > --------------------------------
                          > int pointer;
                          > char databuffer[100];
                          >
                          > double uint64;
                          > unsigned long uint32;
                          >
                          > pointer =0;
                          >
                          > // this works:
                          > uint32 = 1111111; // anything
                          > databuffer[pointer++] = uint32 >> 24;
                          > databuffer[pointer++] = uint32 >> 16;
                          > databuffer[pointer++] = uint32 >> 8;
                          > databuffer[pointer++] = uint32 >> 0; // jup, i know..!
                          >
                          > // this won't:
                          > uint64 = 1111111; // anything
                          > databuffer[pointer++] = uint64 >> 56;
                          > databuffer[pointer++] = uint64 >> 48;
                          > databuffer[pointer++] = uint64 >> 40;
                          > databuffer[pointer++] = uint64 >> 32;
                          > databuffer[pointer++] = uint64 >> 24;
                          > databuffer[pointer++] = uint64 >> 16;
                          > databuffer[pointer++] = uint64 >> 8;
                          > databuffer[pointer++] = uint64 >> 0;
                          >
                          >
                          >[/color]
                          Just because you name it "uint64" does not make it an integer data type.

                          The declaration of: "double uint64;" still define a floating point data
                          type.

                          If you're using gcc try: "unsigned long long uint64;"

                          If it's a VC compiler try: "unsigned _int64 uint64;"


                          [ See http://www.gotw.ca/resources/clcm.htm for info about ]
                          [ comp.lang.c++.m oderated. First time posters: Do this! ]

                          Comment

                          • André Kempe

                            #14
                            Re: bytes: shifting doubles?

                            Allan Rydberg schrieb:[color=blue]
                            > hi
                            >
                            > i'm trying to shift a double, but i'm getting the
                            > error message '>>' illegal, left operand double.
                            >
                            > althought that the manpages say, '>>' and '<<' can
                            > be applied for int's only, i was able to use the
                            > shift operator on unsigned longs without any problems.
                            > does anyone know how to do this properly?
                            >
                            > i.e. individually copying bytes into a long array:
                            > --------------------------------
                            > int pointer;
                            > char databuffer[100];
                            >
                            > double uint64;
                            > unsigned long uint32;
                            >[/color]
                            <snip>[color=blue]
                            > // this won't:
                            > uint64 = 1111111; // anything
                            > databuffer[pointer++] = uint64 >> 56;[/color]

                            it does not work since bit-shifts are defined for integer-constants
                            only, not for floating-point numbers.

                            these have a defined structure, defined as an ieee-standard (don't know
                            which one though), shifting it might destroy this structure. only way is
                            to cast to integer-type of the same size (float->integer, both size
                            4-byte on x86 ), and shift this one.

                            [ See http://www.gotw.ca/resources/clcm.htm for info about ]
                            [ comp.lang.c++.m oderated. First time posters: Do this! ]

                            Comment

                            • Keith Thompson

                              #15
                              Re: bytes: shifting doubles?

                              Allan Rydberg <alrdbg@southte ch.net> writes:[color=blue]
                              > i'm trying to shift a double, but i'm getting the
                              > error message '>>' illegal, left operand double.
                              >
                              > althought that the manpages say, '>>' and '<<' can
                              > be applied for int's only, i was able to use the
                              > shift operator on unsigned longs without any problems.
                              > does anyone know how to do this properly?[/color]

                              The "<<" and ">>" operators can be applied to any integer type (the
                              left operand should usually be unsigned).

                              They cannot be applied to any floating-point type, including double.
                              [color=blue]
                              > i.e. individually copying bytes into a long array:
                              > --------------------------------
                              > int pointer;
                              > char databuffer[100];
                              >
                              > double uint64;
                              > unsigned long uint32;
                              >
                              > pointer =0;[/color]

                              Your variable names are misleading. The name "pointer" implies that
                              it's a pointer; "index" would be clearer. "uint64" and "uint32" look
                              like type names rather than variable names. And finally, "uint64" is
                              misleading for a variable of type double, which is not an integer
                              type.
                              [color=blue]
                              > // this works:
                              > uint32 = 1111111; // anything
                              > databuffer[pointer++] = uint32 >> 24;
                              > databuffer[pointer++] = uint32 >> 16;
                              > databuffer[pointer++] = uint32 >> 8;
                              > databuffer[pointer++] = uint32 >> 0; // jup, i know..![/color]

                              Ok.
                              [color=blue]
                              > // this won't:
                              > uint64 = 1111111; // anything
                              > databuffer[pointer++] = uint64 >> 56;
                              > databuffer[pointer++] = uint64 >> 48;
                              > databuffer[pointer++] = uint64 >> 40;
                              > databuffer[pointer++] = uint64 >> 32;
                              > databuffer[pointer++] = uint64 >> 24;
                              > databuffer[pointer++] = uint64 >> 16;
                              > databuffer[pointer++] = uint64 >> 8;
                              > databuffer[pointer++] = uint64 >> 0;[/color]

                              What are you trying to accomplish?

                              --
                              Keith Thompson (The_Other_Keit h) kst-u@mib.org <http://www.ghoti.net/~kst>
                              San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
                              We must do something. This is something. Therefore, we must do this.

                              [ See http://www.gotw.ca/resources/clcm.htm for info about ]
                              [ comp.lang.c++.m oderated. First time posters: Do this! ]

                              Comment

                              Working...