Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#1190 closed Defect (wontfix)

checkSize returns always 1

Reported by: serval2412 Owned by: davea
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 (5)

comment:1 Changed 12 years ago by Nicolas

Description: modified (diff)

Fixed bug formatting.

comment:2 Changed 12 years ago by Christian Beer

Component: UndeterminedBOINC - Graphics API
Owner: set to davea

comment:3 Changed 12 years ago by Christian Beer

This function is located in boinc/api/texture.cpp (line 227) and referenced twice in the same file (line 337) in function read_tga_texture()

comment:4 Changed 12 years ago by davea

Resolution: wontfix
Status: newclosed

"x is a multiple of 2" isn't the same as "x is a power of 2".

In any case: I don't know this code; I assume the return 1 is there for a reason (like maybe the power-of-2 requirement doesn't exist any more). Also, no one uses .tga files AFAIK.

comment:5 Changed 12 years ago by serval2412

Shame on me ! :-( You're right of course ! I don't know why I thought about modulo 2 for this... Sorry for the noise

Note: See TracTickets for help on using tickets.