[Mesa-dev] [PATCH] gallium/util: use explicily sized types for {un, }pack_rgba_{s, u}int

Emil Velikov emil.l.velikov at gmail.com
Tue Jul 16 13:36:37 PDT 2013


On 08/07/13 21:32, Marek Olšák wrote:
> Hi Emil,
> 
> What issue does this patch fix? Is there a nonarchaic CPU architecture
> or a compiler where "int" doesn't have 32 bits?
> 
Pardon my arrogance, but should one consider such a (imho) trivial
patch, after things have exploded ? I do agree that it's a rather
pedantic change, but I always believed that consistency is a good thing.

For what it's worth I have been using this patch for approximately three
weeks with no side effects.

Cheers
Emil

> Marek
> 
> On Mon, Jul 8, 2013 at 8:56 PM, Emil Velikov <emil.l.velikov at gmail.com> wrote:
>> Every function but the above four uses explicitly sized types for their
>> src and dst arguments. Even fetch_rgba_{s,u}int follows the convention.
>>
>> Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
>> ---
>>  src/gallium/auxiliary/util/u_format.c | 8 ++++----
>>  src/gallium/auxiliary/util/u_format.h | 8 ++++----
>>  2 files changed, 8 insertions(+), 8 deletions(-)
>>
>> diff --git a/src/gallium/auxiliary/util/u_format.c b/src/gallium/auxiliary/util/u_format.c
>> index 686ca8a..08ef6ab 100644
>> --- a/src/gallium/auxiliary/util/u_format.c
>> +++ b/src/gallium/auxiliary/util/u_format.c
>> @@ -297,7 +297,7 @@ util_format_read_4ui(enum pipe_format format,
>>  {
>>     const struct util_format_description *format_desc;
>>     const uint8_t *src_row;
>> -   unsigned *dst_row;
>> +   uint32_t *dst_row;
>>
>>     format_desc = util_format_description(format);
>>
>> @@ -318,7 +318,7 @@ util_format_write_4ui(enum pipe_format format,
>>  {
>>     const struct util_format_description *format_desc;
>>     uint8_t *dst_row;
>> -   const unsigned *src_row;
>> +   const uint32_t *src_row;
>>
>>     format_desc = util_format_description(format);
>>
>> @@ -339,7 +339,7 @@ util_format_read_4i(enum pipe_format format,
>>  {
>>     const struct util_format_description *format_desc;
>>     const uint8_t *src_row;
>> -   int *dst_row;
>> +   int32_t *dst_row;
>>
>>     format_desc = util_format_description(format);
>>
>> @@ -360,7 +360,7 @@ util_format_write_4i(enum pipe_format format,
>>  {
>>     const struct util_format_description *format_desc;
>>     uint8_t *dst_row;
>> -   const int *src_row;
>> +   const int32_t *src_row;
>>
>>     format_desc = util_format_description(format);
>>
>> diff --git a/src/gallium/auxiliary/util/u_format.h b/src/gallium/auxiliary/util/u_format.h
>> index bb729c0..28527f5 100644
>> --- a/src/gallium/auxiliary/util/u_format.h
>> +++ b/src/gallium/auxiliary/util/u_format.h
>> @@ -361,13 +361,13 @@ struct util_format_description
>>      * Only defined for INT formats.
>>      */
>>     void
>> -   (*unpack_rgba_uint)(unsigned *dst, unsigned dst_stride,
>> +   (*unpack_rgba_uint)(uint32_t *dst, unsigned dst_stride,
>>                         const uint8_t *src, unsigned src_stride,
>>                         unsigned width, unsigned height);
>>
>>     void
>>     (*pack_rgba_uint)(uint8_t *dst, unsigned dst_stride,
>> -                     const unsigned *src, unsigned src_stride,
>> +                     const uint32_t *src, unsigned src_stride,
>>                       unsigned width, unsigned height);
>>
>>    /**
>> @@ -377,13 +377,13 @@ struct util_format_description
>>      * Only defined for INT formats.
>>      */
>>     void
>> -   (*unpack_rgba_sint)(signed *dst, unsigned dst_stride,
>> +   (*unpack_rgba_sint)(int32_t *dst, unsigned dst_stride,
>>                         const uint8_t *src, unsigned src_stride,
>>                         unsigned width, unsigned height);
>>
>>     void
>>     (*pack_rgba_sint)(uint8_t *dst, unsigned dst_stride,
>> -                     const int *src, unsigned src_stride,
>> +                     const int32_t *src, unsigned src_stride,
>>                       unsigned width, unsigned height);
>>
>>     /**
>> --
>> 1.8.3.2
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev



More information about the mesa-dev mailing list