Reduce is it's own reward. Signed-off-by: Dylan Baker <dylanx.c.ba...@intel.com> --- src/intel/vulkan/anv_entrypoints_gen.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/intel/vulkan/anv_entrypoints_gen.py b/src/intel/vulkan/anv_entrypoints_gen.py index 0c9812a846..e1c5ac6ddf 100644 --- a/src/intel/vulkan/anv_entrypoints_gen.py +++ b/src/intel/vulkan/anv_entrypoints_gen.py @@ -22,6 +22,7 @@ # IN THE SOFTWARE. # +import functools import os import sys import textwrap @@ -259,11 +260,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): -- 2.11.1 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev