[Piglit] [PATCH 1/5] util: Wrapper to load exact hex patterns for ints
Andres Gomez
agomez at igalia.com
Fri Jul 1 15:05:25 UTC 2016
On Fri, 2016-07-01 at 16:02 +0100, Emil Velikov wrote:
> On 30 June 2016 at 10:19, Andres Gomez <agomez at igalia.com> wrote:
> > On Wed, 2016-06-29 at 17:46 +0100, Emil Velikov wrote:
> > > On 14 June 2016 at 22:36, Andres Gomez <agomez at igalia.com> wrote:
> > > > For some cases we want to have shaders where we load an exact
> > > > bit
> > > > pattern into a signed int.
> > > >
> > > > This fixes the errno-based range validation that was broken
> > > > when
> > > > the
> > > > integer vbo attribute parsing on 32-bit systems was recently
> > > > fixed.
> > > >
> > > Is this because strtol{,l} requires the '-' sign to prefix the
> > > negative values, while we feed it a unsigned encoded signed value
> > > ?
> > > I.e. function throws an error if we give it 0x8000 0000, as it
> > > expects
> > > -0x7fff ffff.
> > > Or is that due to sizeof(long) varying between 32 and 64bit
> > > systems ?
> >
> > I would say, both.
> >
> > As you say, for negative values we would have to pass the hex
> > values
> > as -0x7fff ffff while we want to pass the exact bit
> > representation: 0x8000 0000 ...
> >
> > ... and, because of that, in order to allow it without problems in
> > 32bit systems, in the previous implementation we were using
> > strtoll,
> > which was then making useless its internal validation for values
> > inside
> > the range of long.
> >
> Any chance if you can use that (or a fraction of it) as commit msg :-
> )
Sure!
> Side note: the "skip spaces and tabs" comment and the while loop is
> copy pasta from other strto*_hex() functions in piglit-util.h.
> Strictly speaking the strto* API uses isspace(), while "space and
> tabs" refers to isblank().
>
> Perhaps it's worth using isspace, perhaps it isn't.
I will check. Thanks for the comments! :)
--
Br,
Andres
More information about the Piglit
mailing list