[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] 7 failures and 1 error in test suite



Hi,

the Color 64bit errors are fixed.  A combination of testing against LONG_MAX, and using Uint32.

Committed revision 2472.

cheers,


On Thu, Jul 2, 2009 at 11:52 PM, Hugo Arts <hugo.yoshi@xxxxxxxxx> wrote:
On Thu, Jul 2, 2009 at 2:55 PM, <don@xxxxxxxxxxxxxxxxx> wrote:
>
> Hi,
>
> On Thu, 2 Jul 2009 09:48:48 +1000, René Dudfield <renesd@xxxxxxxxx> wrote:
>> Cool, thanks for the testing.
>>
>>
>> On Thu, Jul 2, 2009 at 9:19 AM, Lorenz Quack<don@xxxxxxxxxxxxxxxxx> wrote:
>>> Ok, so here goes my analysis of the failures in ColorTypeTest:
>>> In src/color.c line 1435 (and some following lines) we bit shift each
>> color
>>> component and stuff them
>>> in an unsigned long.
>>
>> Maybe this should be into a uint32 instead?
>>
>
> Yes, that would correspond to my solution 1) only better because it ensures that it will have exactly 32 bit.
> BTW, are these types uint32, UInt8, ... in the C-standard?
>
> yours
> //Lorenz
>

No. ANSI C only defines the char, int, float, and double types, along
with the short/long and signed/unsigned modifiers.
The sizes of these types are not defined in the standard. ANSI only
gives some minimum sizes, and mandates that

short int <= int <= long int
float <= double <= long double

So, in theory, the size of your int type is completely platform
dependent. In practice nearly every modern compiler uses the same
sizes,
char = 8, int = 32, float = 32, double = 64, but there are some
differences between 32bit and 64bit architectures (e.g. long int is
usually the same size as int on 32bit). Hence the often defined
uint32, uint8 etc. types.

See also http://en.wikipedia.org/wiki/C_data_types

Hugo