[Mesa-dev] [PATCH 5/8] i965: Add script to gen code for OA counter queries
Dylan Baker
dylan at pnwbakers.com
Wed Mar 1 17:26:05 UTC 2017
Quoting Robert Bragg (2017-03-01 08:58:09)
> On Wed, Mar 1, 2017 at 3:57 PM, Robert Bragg <robert at sixbynine.org> wrote:
> > On Mon, Feb 27, 2017 at 8:01 PM, Dylan Baker <dylan at pnwbakers.com> wrote:
>
> >>> +def output_rpn_equation_code(set, counter, equation, counter_vars):
> >>> + c("/* RPN equation: " + equation + " */")
> >>> + tokens = equation.split()
> >>> + stack = []
> >>> + tmp_id = 0
> >>> + tmp = None
> >>> +
> >>> + for token in tokens:
> >>> + stack.append(token)
> >>> + while stack and stack[-1] in ops:
> >>> + op = stack.pop()
> >>> + argc, callback = ops[op]
> >>> + args = []
> >>> + for i in range(0, argc):
> >>
> >> Use xrange instead of range
> >
> > okey, can do.
>
> I just realised that the use of xrange() became the only thing
> stopping the script from being python version agnostic (python 3
> removes xrange and plain range() behaves like xrange()) so I went back
> to using range() here.
No worries either way, it's not an extremely huge range, so python2's range
isn't terrible (in python 3 "range" is python 2's "xrange"). I'm assuming that
when we move to python3 in mesa that we'll be hybridized for years because of
enterprise OSes.
Dylan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170301/502145f9/attachment-0001.sig>
More information about the mesa-dev
mailing list