About very long Bit-numbers (bitfields?)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Juha Kettunen

    About very long Bit-numbers (bitfields?)

    Hi

    I don't know if I am using right words (bit-number), but this is what I
    mean:

    You can set a 64 bit number:

    unsigned long a;

    Now you can use binary operators to manipulate variable a (for example
    a |= (unsigned long) 128
    ).

    How about if I want to get for example a 640 bit long *one* number (say b)
    and do the same binary operations to it (b |= 128)? I haven't found answer
    for this ... do I need to use Bitfields:

    struct BITS
    {
    unsigned long b1;
    unsigned long b2;
    unsigned long b3;
    .... (10 times)
    };

    I don't know ...


  • Christopher Benson-Manica

    #2
    Re: About very long Bit-numbers (bitfields?)

    Juha Kettunen <not@valid.co m> spoke thus:
    [color=blue]
    > How about if I want to get for example a 640 bit long *one* number (say b)
    > and do the same binary operations to it (b |= 128)? I haven't found answer
    > for this ... do I need to use Bitfields:[/color]

    You might look at vector<bool>, although I have no idea how useful
    you'll find it.

    --
    Christopher Benson-Manica | I *should* know what I'm talking about - if I
    ataru(at)cybers pace.org | don't, I need to know. Flames welcome.

    Comment

    • Christopher Benson-Manica

      #3
      Re: About very long Bit-numbers (bitfields?)

      Juha Kettunen <not@valid.co m> spoke thus:
      [color=blue]
      > How about if I want to get for example a 640 bit long *one* number (say b)
      > and do the same binary operations to it (b |= 128)? I haven't found answer
      > for this ... do I need to use Bitfields:[/color]

      You might look at vector<bool>, although I have no idea how useful
      you'll find it.

      --
      Christopher Benson-Manica | I *should* know what I'm talking about - if I
      ataru(at)cybers pace.org | don't, I need to know. Flames welcome.

      Comment

      • Leor Zolman

        #4
        Re: About very long Bit-numbers (bitfields?)

        On Fri, 9 Apr 2004 10:33:24 +0100, "Juha Kettunen" <not@valid.co m> wrote:
        [color=blue]
        >Hi
        >
        >I don't know if I am using right words (bit-number), but this is what I
        >mean:
        >
        >You can set a 64 bit number:
        >
        >unsigned long a;[/color]

        Just FYI, the number of bits in a long (unsigned or otherwise) is
        platform-dependent. On my system they're only 32 bits. But that doesn't
        have much bearing on your real question, which is how to get /real/ long
        bit sequences.
        [color=blue]
        >How about if I want to get for example a 640 bit long *one* number (say b)
        >and do the same binary operations to it (b |= 128)? I haven't found answer
        >for this ... do I need to use Bitfields:[/color]

        For that, Christopher's suggestion of vector<bool> may be adequate.
        vector<bool> is the "black sheep" of the STL container family...becaus e it
        doesn't meet all the usual vector requirements:

        #include <vector>

        int main()
        {
        std::vector<cha r> vc;
        std::vector<boo l> vb;

        vc.push_back('x ');
        vc.push_back('y ');
        vb.push_back(tr ue);
        vb.push_back(tr ue);

        std::vector<cha r>::iterator vcit = vc.begin();
        std::vector<boo l>::iterator vbit = vb.begin();

        *vcit = 'z'; // OK
        *vbit = false; // OK

        char *cp = &vc[0]; // OK
        bool *bp = &vb[0]; // Oops: won't compile.

        return 0;
        }

        On the other hand, it provides some operation specialized for bits that
        std::vector<som ething-other-than-bool> does not. Josuttis 6.2.6 has the
        gory details. If you can avoid the potholes, it may work fine for you.
        -leor

        --
        Leor Zolman --- BD Software --- www.bdsoft.com
        On-Site Training in C/C++, Java, Perl and Unix
        C++ users: Download BD Software's free STL Error Message Decryptor at:
        An STL Error Decryptor for C++ by Leor Zolman of BD Software - available to download here

        Comment

        • Leor Zolman

          #5
          Re: About very long Bit-numbers (bitfields?)

          On Fri, 9 Apr 2004 10:33:24 +0100, "Juha Kettunen" <not@valid.co m> wrote:
          [color=blue]
          >Hi
          >
          >I don't know if I am using right words (bit-number), but this is what I
          >mean:
          >
          >You can set a 64 bit number:
          >
          >unsigned long a;[/color]

          Just FYI, the number of bits in a long (unsigned or otherwise) is
          platform-dependent. On my system they're only 32 bits. But that doesn't
          have much bearing on your real question, which is how to get /real/ long
          bit sequences.
          [color=blue]
          >How about if I want to get for example a 640 bit long *one* number (say b)
          >and do the same binary operations to it (b |= 128)? I haven't found answer
          >for this ... do I need to use Bitfields:[/color]

          For that, Christopher's suggestion of vector<bool> may be adequate.
          vector<bool> is the "black sheep" of the STL container family...becaus e it
          doesn't meet all the usual vector requirements:

          #include <vector>

          int main()
          {
          std::vector<cha r> vc;
          std::vector<boo l> vb;

          vc.push_back('x ');
          vc.push_back('y ');
          vb.push_back(tr ue);
          vb.push_back(tr ue);

          std::vector<cha r>::iterator vcit = vc.begin();
          std::vector<boo l>::iterator vbit = vb.begin();

          *vcit = 'z'; // OK
          *vbit = false; // OK

          char *cp = &vc[0]; // OK
          bool *bp = &vb[0]; // Oops: won't compile.

          return 0;
          }

          On the other hand, it provides some operation specialized for bits that
          std::vector<som ething-other-than-bool> does not. Josuttis 6.2.6 has the
          gory details. If you can avoid the potholes, it may work fine for you.
          -leor

          --
          Leor Zolman --- BD Software --- www.bdsoft.com
          On-Site Training in C/C++, Java, Perl and Unix
          C++ users: Download BD Software's free STL Error Message Decryptor at:
          An STL Error Decryptor for C++ by Leor Zolman of BD Software - available to download here

          Comment

          • Juha Kettunen

            #6
            Re: About very long Bit-numbers (bitfields?)

            ok , thanks for you and Christopher. I will check that vector<bool>.

            Hmm but I think cannot do bit operations for it:

            vector<bool> a;

            a |= 128;

            The main point is, that I really need to be able to do similar operations
            than bit operations to get some benefit in my code (That means, that set
            *many* bits at the same time, as b |= 128 does). But maybe I can do it with
            that vector ....

            But anyway, it seems to be second best (better than normal arrays) if I
            cannot use bit operations...

            "Leor Zolman" <leor@bdsoft.co m> wrote in message
            news:fkrd70l8e9 ip1bc2qbfg6snq0 a0fau8e62@4ax.c om...[color=blue]
            > On Fri, 9 Apr 2004 10:33:24 +0100, "Juha Kettunen" <not@valid.co m> wrote:
            >[color=green]
            > >Hi
            > >
            > >I don't know if I am using right words (bit-number), but this is what I
            > >mean:
            > >
            > >You can set a 64 bit number:
            > >
            > >unsigned long a;[/color]
            >
            > Just FYI, the number of bits in a long (unsigned or otherwise) is
            > platform-dependent. On my system they're only 32 bits. But that doesn't
            > have much bearing on your real question, which is how to get /real/ long
            > bit sequences.
            >[color=green]
            > >How about if I want to get for example a 640 bit long *one* number (say[/color][/color]
            b)[color=blue][color=green]
            > >and do the same binary operations to it (b |= 128)? I haven't found[/color][/color]
            answer[color=blue][color=green]
            > >for this ... do I need to use Bitfields:[/color]
            >
            > For that, Christopher's suggestion of vector<bool> may be adequate.
            > vector<bool> is the "black sheep" of the STL container family...becaus e it
            > doesn't meet all the usual vector requirements:
            >
            > #include <vector>
            >
            > int main()
            > {
            > std::vector<cha r> vc;
            > std::vector<boo l> vb;
            >
            > vc.push_back('x ');
            > vc.push_back('y ');
            > vb.push_back(tr ue);
            > vb.push_back(tr ue);
            >
            > std::vector<cha r>::iterator vcit = vc.begin();
            > std::vector<boo l>::iterator vbit = vb.begin();
            >
            > *vcit = 'z'; // OK
            > *vbit = false; // OK
            >
            > char *cp = &vc[0]; // OK
            > bool *bp = &vb[0]; // Oops: won't compile.
            >
            > return 0;
            > }
            >
            > On the other hand, it provides some operation specialized for bits that
            > std::vector<som ething-other-than-bool> does not. Josuttis 6.2.6 has the
            > gory details. If you can avoid the potholes, it may work fine for you.
            > -leor
            >
            > --
            > Leor Zolman --- BD Software --- www.bdsoft.com
            > On-Site Training in C/C++, Java, Perl and Unix
            > C++ users: Download BD Software's free STL Error Message Decryptor at:
            > www.bdsoft.com/tools/stlfilt.html[/color]


            Comment

            • Juha Kettunen

              #7
              Re: About very long Bit-numbers (bitfields?)

              ok , thanks for you and Christopher. I will check that vector<bool>.

              Hmm but I think cannot do bit operations for it:

              vector<bool> a;

              a |= 128;

              The main point is, that I really need to be able to do similar operations
              than bit operations to get some benefit in my code (That means, that set
              *many* bits at the same time, as b |= 128 does). But maybe I can do it with
              that vector ....

              But anyway, it seems to be second best (better than normal arrays) if I
              cannot use bit operations...

              "Leor Zolman" <leor@bdsoft.co m> wrote in message
              news:fkrd70l8e9 ip1bc2qbfg6snq0 a0fau8e62@4ax.c om...[color=blue]
              > On Fri, 9 Apr 2004 10:33:24 +0100, "Juha Kettunen" <not@valid.co m> wrote:
              >[color=green]
              > >Hi
              > >
              > >I don't know if I am using right words (bit-number), but this is what I
              > >mean:
              > >
              > >You can set a 64 bit number:
              > >
              > >unsigned long a;[/color]
              >
              > Just FYI, the number of bits in a long (unsigned or otherwise) is
              > platform-dependent. On my system they're only 32 bits. But that doesn't
              > have much bearing on your real question, which is how to get /real/ long
              > bit sequences.
              >[color=green]
              > >How about if I want to get for example a 640 bit long *one* number (say[/color][/color]
              b)[color=blue][color=green]
              > >and do the same binary operations to it (b |= 128)? I haven't found[/color][/color]
              answer[color=blue][color=green]
              > >for this ... do I need to use Bitfields:[/color]
              >
              > For that, Christopher's suggestion of vector<bool> may be adequate.
              > vector<bool> is the "black sheep" of the STL container family...becaus e it
              > doesn't meet all the usual vector requirements:
              >
              > #include <vector>
              >
              > int main()
              > {
              > std::vector<cha r> vc;
              > std::vector<boo l> vb;
              >
              > vc.push_back('x ');
              > vc.push_back('y ');
              > vb.push_back(tr ue);
              > vb.push_back(tr ue);
              >
              > std::vector<cha r>::iterator vcit = vc.begin();
              > std::vector<boo l>::iterator vbit = vb.begin();
              >
              > *vcit = 'z'; // OK
              > *vbit = false; // OK
              >
              > char *cp = &vc[0]; // OK
              > bool *bp = &vb[0]; // Oops: won't compile.
              >
              > return 0;
              > }
              >
              > On the other hand, it provides some operation specialized for bits that
              > std::vector<som ething-other-than-bool> does not. Josuttis 6.2.6 has the
              > gory details. If you can avoid the potholes, it may work fine for you.
              > -leor
              >
              > --
              > Leor Zolman --- BD Software --- www.bdsoft.com
              > On-Site Training in C/C++, Java, Perl and Unix
              > C++ users: Download BD Software's free STL Error Message Decryptor at:
              > www.bdsoft.com/tools/stlfilt.html[/color]


              Comment

              • Juha Kettunen

                #8
                Re: About very long Bit-numbers (bitfields?)


                "Christophe r Benson-Manica" <ataru@nospam.c yberspace.org> wrote in message
                news:c56ql7$1s8 $1@chessie.cirr .com...[color=blue]
                > Juha Kettunen <not@valid.co m> spoke thus:
                >[color=green]
                > > How about if I want to get for example a 640 bit long *one* number (say[/color][/color]
                b)[color=blue][color=green]
                > > and do the same binary operations to it (b |= 128)? I haven't found[/color][/color]
                answer[color=blue][color=green]
                > > for this ... do I need to use Bitfields:[/color]
                >
                > You might look at vector<bool>, although I have no idea how useful
                > you'll find it.
                >[/color]

                Actually, when I was checking from the "Stroustrup C++" this vector issue
                just now, I recognized, that there is a std::bitset vector type as well,
                which is definetely most suitable for me: It handles binary values and have
                all of those bit operations |=, &=, and so on.

                But thanks, i didnt really even think that vectors could solve my problem
                .... (I thought i must be a struct).

                I will try it now, and see if it *really* works :)...


                Comment

                • Juha Kettunen

                  #9
                  Re: About very long Bit-numbers (bitfields?)


                  "Christophe r Benson-Manica" <ataru@nospam.c yberspace.org> wrote in message
                  news:c56ql7$1s8 $1@chessie.cirr .com...[color=blue]
                  > Juha Kettunen <not@valid.co m> spoke thus:
                  >[color=green]
                  > > How about if I want to get for example a 640 bit long *one* number (say[/color][/color]
                  b)[color=blue][color=green]
                  > > and do the same binary operations to it (b |= 128)? I haven't found[/color][/color]
                  answer[color=blue][color=green]
                  > > for this ... do I need to use Bitfields:[/color]
                  >
                  > You might look at vector<bool>, although I have no idea how useful
                  > you'll find it.
                  >[/color]

                  Actually, when I was checking from the "Stroustrup C++" this vector issue
                  just now, I recognized, that there is a std::bitset vector type as well,
                  which is definetely most suitable for me: It handles binary values and have
                  all of those bit operations |=, &=, and so on.

                  But thanks, i didnt really even think that vectors could solve my problem
                  .... (I thought i must be a struct).

                  I will try it now, and see if it *really* works :)...


                  Comment

                  • Leor Zolman

                    #10
                    Re: About very long Bit-numbers (bitfields?)

                    On Fri, 9 Apr 2004 13:35:19 +0100, "Juha Kettunen" <not@valid.co m> wrote:
                    [color=blue]
                    >
                    >"Christophe r Benson-Manica" <ataru@nospam.c yberspace.org> wrote in message
                    >news:c56ql7$1s 8$1@chessie.cir r.com...[color=green]
                    >> Juha Kettunen <not@valid.co m> spoke thus:
                    >>[color=darkred]
                    >> > How about if I want to get for example a 640 bit long *one* number (say[/color][/color]
                    >b)[color=green][color=darkred]
                    >> > and do the same binary operations to it (b |= 128)? I haven't found[/color][/color]
                    >answer[color=green][color=darkred]
                    >> > for this ... do I need to use Bitfields:[/color]
                    >>
                    >> You might look at vector<bool>, although I have no idea how useful
                    >> you'll find it.
                    >>[/color]
                    >
                    >Actually, when I was checking from the "Stroustrup C++" this vector issue
                    >just now, I recognized, that there is a std::bitset vector type as well,
                    >which is definetely most suitable for me: It handles binary values and have
                    >all of those bit operations |=, &=, and so on.
                    >[/color]

                    Yes, that's clearly a better starting point, and I'm kicking myself for
                    having forgotten about std::bitset. So as not to depart this thread without
                    having at least /something/ helpful to say, let me recommend that you get
                    yourself a copy of Josuttis' "The C++ Standard Library". It is
                    indispensable when trying to choose and then use STL facilities... and it
                    has ten pages on bitset.
                    -leor

                    --
                    Leor Zolman --- BD Software --- www.bdsoft.com
                    On-Site Training in C/C++, Java, Perl and Unix
                    C++ users: Download BD Software's free STL Error Message Decryptor at:
                    An STL Error Decryptor for C++ by Leor Zolman of BD Software - available to download here

                    Comment

                    • Leor Zolman

                      #11
                      Re: About very long Bit-numbers (bitfields?)

                      On Fri, 9 Apr 2004 13:35:19 +0100, "Juha Kettunen" <not@valid.co m> wrote:
                      [color=blue]
                      >
                      >"Christophe r Benson-Manica" <ataru@nospam.c yberspace.org> wrote in message
                      >news:c56ql7$1s 8$1@chessie.cir r.com...[color=green]
                      >> Juha Kettunen <not@valid.co m> spoke thus:
                      >>[color=darkred]
                      >> > How about if I want to get for example a 640 bit long *one* number (say[/color][/color]
                      >b)[color=green][color=darkred]
                      >> > and do the same binary operations to it (b |= 128)? I haven't found[/color][/color]
                      >answer[color=green][color=darkred]
                      >> > for this ... do I need to use Bitfields:[/color]
                      >>
                      >> You might look at vector<bool>, although I have no idea how useful
                      >> you'll find it.
                      >>[/color]
                      >
                      >Actually, when I was checking from the "Stroustrup C++" this vector issue
                      >just now, I recognized, that there is a std::bitset vector type as well,
                      >which is definetely most suitable for me: It handles binary values and have
                      >all of those bit operations |=, &=, and so on.
                      >[/color]

                      Yes, that's clearly a better starting point, and I'm kicking myself for
                      having forgotten about std::bitset. So as not to depart this thread without
                      having at least /something/ helpful to say, let me recommend that you get
                      yourself a copy of Josuttis' "The C++ Standard Library". It is
                      indispensable when trying to choose and then use STL facilities... and it
                      has ten pages on bitset.
                      -leor

                      --
                      Leor Zolman --- BD Software --- www.bdsoft.com
                      On-Site Training in C/C++, Java, Perl and Unix
                      C++ users: Download BD Software's free STL Error Message Decryptor at:
                      An STL Error Decryptor for C++ by Leor Zolman of BD Software - available to download here

                      Comment

                      • Juha Kettunen

                        #12
                        Re: About very long Bit-numbers (bitfields?)


                        "Leor Zolman" <leor@bdsoft.co m> wrote in message
                        news:ad2e70huvn 4hk6r67abr1so6m 6jlt7o0o6@4ax.c om...[color=blue]
                        > On Fri, 9 Apr 2004 13:35:19 +0100, "Juha Kettunen" <not@valid.co m> wrote:
                        >
                        > Yes, that's clearly a better starting point, and I'm kicking myself for
                        > having forgotten about std::bitset. So as not to depart this thread[/color]
                        without[color=blue]
                        > having at least /something/ helpful to say, let me recommend that you get
                        > yourself a copy of Josuttis' "The C++ Standard Library". It is
                        > indispensable when trying to choose and then use STL facilities... and it
                        > has ten pages on bitset.
                        > -leor[/color]

                        Now I tried that bitset, and ... hmmm.. there is one "problem": it is too
                        slow! I need to have very fast calculations, and normal bit operations with
                        integers does that, but it seems to me that bitset is slow. I did two tests:

                        1.
                        bitset<31> a;

                        for (int i=1;i<40000000; i++)
                        {
                        a |= (11 << 10);
                        }


                        2.
                        unsigned long f;

                        for (int i=1;i<40000000; i++)
                        {
                        f |= (11 << 10);
                        }

                        The first one took about 10 seconds to complete, but the second one
                        basically 0 seconds!

                        bitset does the job, but is too slow.

                        Is there a way to do it fast (basically I mean that if you use bitset<300>
                        a;)?


                        Comment

                        • Juha Kettunen

                          #13
                          Re: About very long Bit-numbers (bitfields?)


                          "Leor Zolman" <leor@bdsoft.co m> wrote in message
                          news:ad2e70huvn 4hk6r67abr1so6m 6jlt7o0o6@4ax.c om...[color=blue]
                          > On Fri, 9 Apr 2004 13:35:19 +0100, "Juha Kettunen" <not@valid.co m> wrote:
                          >
                          > Yes, that's clearly a better starting point, and I'm kicking myself for
                          > having forgotten about std::bitset. So as not to depart this thread[/color]
                          without[color=blue]
                          > having at least /something/ helpful to say, let me recommend that you get
                          > yourself a copy of Josuttis' "The C++ Standard Library". It is
                          > indispensable when trying to choose and then use STL facilities... and it
                          > has ten pages on bitset.
                          > -leor[/color]

                          Now I tried that bitset, and ... hmmm.. there is one "problem": it is too
                          slow! I need to have very fast calculations, and normal bit operations with
                          integers does that, but it seems to me that bitset is slow. I did two tests:

                          1.
                          bitset<31> a;

                          for (int i=1;i<40000000; i++)
                          {
                          a |= (11 << 10);
                          }


                          2.
                          unsigned long f;

                          for (int i=1;i<40000000; i++)
                          {
                          f |= (11 << 10);
                          }

                          The first one took about 10 seconds to complete, but the second one
                          basically 0 seconds!

                          bitset does the job, but is too slow.

                          Is there a way to do it fast (basically I mean that if you use bitset<300>
                          a;)?


                          Comment

                          • Julie

                            #14
                            Re: About very long Bit-numbers (bitfields?)

                            Juha Kettunen wrote:[color=blue]
                            >
                            > "Leor Zolman" <leor@bdsoft.co m> wrote in message
                            > news:ad2e70huvn 4hk6r67abr1so6m 6jlt7o0o6@4ax.c om...[color=green]
                            > > On Fri, 9 Apr 2004 13:35:19 +0100, "Juha Kettunen" <not@valid.co m> wrote:
                            > >
                            > > Yes, that's clearly a better starting point, and I'm kicking myself for
                            > > having forgotten about std::bitset. So as not to depart this thread[/color]
                            > without[color=green]
                            > > having at least /something/ helpful to say, let me recommend that you get
                            > > yourself a copy of Josuttis' "The C++ Standard Library". It is
                            > > indispensable when trying to choose and then use STL facilities... and it
                            > > has ten pages on bitset.
                            > > -leor[/color]
                            >
                            > Now I tried that bitset, and ... hmmm.. there is one "problem": it is too
                            > slow! I need to have very fast calculations, and normal bit operations with
                            > integers does that, but it seems to me that bitset is slow. I did two tests:
                            >
                            > 1.
                            > bitset<31> a;
                            >
                            > for (int i=1;i<40000000; i++)
                            > {
                            > a |= (11 << 10);
                            > }
                            >
                            > 2.
                            > unsigned long f;
                            >
                            > for (int i=1;i<40000000; i++)
                            > {
                            > f |= (11 << 10);
                            > }
                            >
                            > The first one took about 10 seconds to complete, but the second one
                            > basically 0 seconds!
                            >
                            > bitset does the job, but is too slow.
                            >
                            > Is there a way to do it fast (basically I mean that if you use bitset<300>
                            > a;)?[/color]

                            Careful there -- did you examine the executable code for loop 2? As far as I
                            know, it isn't unreasonable to expect an optimizing compiler to reduce that to
                            a single statement since the loop operand is constant.

                            Recreate your test using an operand that isn't constant, verify the executable
                            code, and re-run the test.

                            Comment

                            • Julie

                              #15
                              Re: About very long Bit-numbers (bitfields?)

                              Juha Kettunen wrote:[color=blue]
                              >
                              > "Leor Zolman" <leor@bdsoft.co m> wrote in message
                              > news:ad2e70huvn 4hk6r67abr1so6m 6jlt7o0o6@4ax.c om...[color=green]
                              > > On Fri, 9 Apr 2004 13:35:19 +0100, "Juha Kettunen" <not@valid.co m> wrote:
                              > >
                              > > Yes, that's clearly a better starting point, and I'm kicking myself for
                              > > having forgotten about std::bitset. So as not to depart this thread[/color]
                              > without[color=green]
                              > > having at least /something/ helpful to say, let me recommend that you get
                              > > yourself a copy of Josuttis' "The C++ Standard Library". It is
                              > > indispensable when trying to choose and then use STL facilities... and it
                              > > has ten pages on bitset.
                              > > -leor[/color]
                              >
                              > Now I tried that bitset, and ... hmmm.. there is one "problem": it is too
                              > slow! I need to have very fast calculations, and normal bit operations with
                              > integers does that, but it seems to me that bitset is slow. I did two tests:
                              >
                              > 1.
                              > bitset<31> a;
                              >
                              > for (int i=1;i<40000000; i++)
                              > {
                              > a |= (11 << 10);
                              > }
                              >
                              > 2.
                              > unsigned long f;
                              >
                              > for (int i=1;i<40000000; i++)
                              > {
                              > f |= (11 << 10);
                              > }
                              >
                              > The first one took about 10 seconds to complete, but the second one
                              > basically 0 seconds!
                              >
                              > bitset does the job, but is too slow.
                              >
                              > Is there a way to do it fast (basically I mean that if you use bitset<300>
                              > a;)?[/color]

                              Careful there -- did you examine the executable code for loop 2? As far as I
                              know, it isn't unreasonable to expect an optimizing compiler to reduce that to
                              a single statement since the loop operand is constant.

                              Recreate your test using an operand that isn't constant, verify the executable
                              code, and re-run the test.

                              Comment

                              Working...