1.1 --- a/encoders.py Mon Feb 20 18:50:16 2017 +0100
1.2 +++ b/encoders.py Tue Feb 21 00:20:43 2017 +0100
1.3 @@ -21,6 +21,21 @@
1.4
1.5 from common import first, InstructionSequence
1.6
1.7 +
1.8 +
1.9 +# Value digest computation.
1.10 +
1.11 +from base64 import b64encode
1.12 +from hashlib import sha1
1.13 +
1.14 +def digest(values):
1.15 + m = sha1()
1.16 + for value in values:
1.17 + m.update(str(value))
1.18 + return b64encode(m.digest()).replace("+", "__").replace("/", "_").rstrip("=")
1.19 +
1.20 +
1.21 +
1.22 # Output encoding and decoding for the summary files.
1.23
1.24 def encode_attrnames(attrnames):
1.25 @@ -394,7 +409,7 @@
1.26
1.27 "Encode a name for the literal constant with the number 'n'."
1.28
1.29 - return "__const%d" % n
1.30 + return "__const%s" % n
1.31
1.32 def encode_literal_constant_size(value):
1.33
1.34 @@ -454,7 +469,7 @@
1.35
1.36 "Encode a reference to a literal constant with the number 'n'."
1.37
1.38 - return "__constvalue%d" % n
1.39 + return "__constvalue%s" % n
1.40
1.41
1.42