Opened 12 years ago

Last modified 12 years ago

#1190 closed Defect

checkSize returns always 1 — at Version 1

Reported by: serval2412 Owned by:
Priority: Undetermined Milestone: Undetermined
Component: BOINC - Graphics API Version: 7.0.25
Keywords: Cc:

Description (last modified by Nicolas)

Hello,

Here is the function checkSize

//      =============
//      checkSize
//      Make sure its a power of 2.
//      =============
int checkSize (int x){
        return 1;
        if (x == 2       || x == 4   ||
        x == 8   || x == 16  ||
        x == 32  || x == 64  ||
        x == 128 || x == 256 || x == 512)
                return 1;
    else
                return 0;
}

Either, we can remove checkSize function completety or "return 1" should be removed. In the last case, this function could be simply replaced by :

int checkSize (int x){
   return ((x mod 2) == 0);
}

If x can't be not more than 512, we could obviously change the function above like this :

int checkSize (int x){
   if (x > 512) return 0;
   return ((x mod 2) == 0);
}

then it could be interesting to comment why x can't be > 512

Julien.

Change History (1)

comment:1 Changed 12 years ago by Nicolas

Description: modified (diff)

Fixed bug formatting.

Note: See TracTickets for help on using tickets.