You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bcel-dev@jakarta.apache.org by Yudhi Widyatama <y_...@yahoo.com> on 2006/04/12 13:01:37 UTC

loop limiter in BCELifier.printFlags

Hi,
I'm wondering about the line 195 in
org/apache/bcel/util/BCELifier.java (trunk code in
SVN):
         for (int i = 0, pow = 1; i <=
Constants.MAX_ACC_FLAG; i++) {
...
            pow <<= 1;
        }
If I understand this correctly, there is no need to do
the loop 0x4000 times (which is the value of
Constants.MAX_ACC_FLAG). I thought it would be better
like this:
        for (int i = 0, pow = 1; i <
Constants.ACCESS_NAMES.length; i++) {
Pardon me if I'm wrong.
Regards,

Yudhi Widyatama


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-dev-help@jakarta.apache.org


Re: loop limiter in BCELifier.printFlags

Posted by Torsten Curdt <tc...@apache.org>.
Yudhi,

Well spotted! ..but I think your fix is not correct.
I think it should just be

  for (int i = 0, pow = 1; pow <= Constants.MAX_ACC_FLAG; i++) {
    ...
    pow <<= 1;
  }

cheers
--
Torsten

On 4/12/06, Yudhi Widyatama <y_...@yahoo.com> wrote:
> Hi,
> I'm wondering about the line 195 in
> org/apache/bcel/util/BCELifier.java (trunk code in
> SVN):
>          for (int i = 0, pow = 1; i <=
> Constants.MAX_ACC_FLAG; i++) {
> ...
>             pow <<= 1;
>         }
> If I understand this correctly, there is no need to do
> the loop 0x4000 times (which is the value of
> Constants.MAX_ACC_FLAG).
> I thought it would be better
> like this:
>         for (int i = 0, pow = 1; i <
> Constants.ACCESS_NAMES.length; i++) {
> Pardon me if I'm wrong.

---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-dev-help@jakarta.apache.org