diff options
author | Dylan Baker <[email protected]> | 2017-02-21 11:00:41 -0800 |
---|---|---|
committer | Dylan Baker <[email protected]> | 2017-03-22 16:22:00 -0700 |
commit | 96a5f2a5acbe952ce6b18e74edf99b46777f15fc (patch) | |
tree | 97f37222cf6b66bf5841800d2152d4e8703ebf9e /src/intel | |
parent | dd3830d11b69612ea5ae5befde030885e0f6df63 (diff) |
anv: anv_entrypoints_gen.py: use reduce function.
Reduce is it's own reward.
Signed-off-by: Dylan Baker <[email protected]>
Diffstat (limited to 'src/intel')
-rw-r--r-- | src/intel/vulkan/anv_entrypoints_gen.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/intel/vulkan/anv_entrypoints_gen.py b/src/intel/vulkan/anv_entrypoints_gen.py index a63badb4770..6b2d4220150 100644 --- a/src/intel/vulkan/anv_entrypoints_gen.py +++ b/src/intel/vulkan/anv_entrypoints_gen.py @@ -23,6 +23,7 @@ # import argparse +import functools import os import textwrap import xml.etree.ElementTree as et @@ -258,11 +259,8 @@ PRIME_STEP = 19 def cal_hash(name): """Calculate the same hash value that Mesa will calculate in C.""" - h = 0 - for c in name: - h = (h * PRIME_FACTOR + ord(c)) & U32_MASK - - return h + return functools.reduce( + lambda h, c: (h * PRIME_FACTOR + ord(c)) & U32_MASK, name, 0) def get_entrypoints(doc, entrypoints_to_defines): |