anv: anv_entrypoints_gen.py: use reduce function.
Reduce is it's own reward. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
This commit is contained in:
@@ -23,6 +23,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
import functools
|
||||||
import os
|
import os
|
||||||
import textwrap
|
import textwrap
|
||||||
import xml.etree.ElementTree as et
|
import xml.etree.ElementTree as et
|
||||||
@@ -258,11 +259,8 @@ PRIME_STEP = 19
|
|||||||
|
|
||||||
def cal_hash(name):
|
def cal_hash(name):
|
||||||
"""Calculate the same hash value that Mesa will calculate in C."""
|
"""Calculate the same hash value that Mesa will calculate in C."""
|
||||||
h = 0
|
return functools.reduce(
|
||||||
for c in name:
|
lambda h, c: (h * PRIME_FACTOR + ord(c)) & U32_MASK, name, 0)
|
||||||
h = (h * PRIME_FACTOR + ord(c)) & U32_MASK
|
|
||||||
|
|
||||||
return h
|
|
||||||
|
|
||||||
|
|
||||||
def get_entrypoints(doc, entrypoints_to_defines):
|
def get_entrypoints(doc, entrypoints_to_defines):
|
||||||
|
Reference in New Issue
Block a user