[Piglit] [PATCH 17/45] gen_shader_bit_encoding_tests.py: use builtin operators
Dylan Baker
baker.dylan.c at gmail.com
Wed Nov 12 15:45:59 PST 2014
python provides operators to do most of what was being done with rolled
operators, so lets use them
Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
generated_tests/gen_shader_bit_encoding_tests.py | 21 +++++----------------
1 file changed, 5 insertions(+), 16 deletions(-)
diff --git a/generated_tests/gen_shader_bit_encoding_tests.py b/generated_tests/gen_shader_bit_encoding_tests.py
index d409db0..1b2f028 100644
--- a/generated_tests/gen_shader_bit_encoding_tests.py
+++ b/generated_tests/gen_shader_bit_encoding_tests.py
@@ -23,6 +23,7 @@
import struct
import os
+from operator import neg
from templates import template_file
@@ -45,18 +46,6 @@ def uintbitstofloat(u):
return struct.unpack('f', struct.pack('I', u))[0]
-def passthrough(f):
- return f
-
-
-def neg(num):
- return -num
-
-
-def neg_abs(num):
- return -abs(num)
-
-
def vec4(f):
return [f, f, f, f]
@@ -85,13 +74,13 @@ test_data = {
funcs = {
'floatBitsToInt': {
- 'in_func': passthrough,
+ 'in_func': lambda x: x,
'out_func': floatbitstoint,
'input': 'vec4',
'output': 'ivec4'
},
'floatBitsToUint': {
- 'in_func': passthrough,
+ 'in_func': lambda x: x,
'out_func': floatbitstouint,
'input': 'vec4',
'output': 'uvec4'
@@ -111,10 +100,10 @@ funcs = {
}
modifier_funcs = {
- '': passthrough,
+ '': lambda x: x,
'abs': abs,
'neg': neg,
- 'neg_abs': neg_abs
+ 'neg_abs': lambda x: neg(abs(x))
}
requirements = {
--
2.1.3
More information about the Piglit
mailing list