Commit b3653cbb authored by Michael Büsch's avatar Michael Büsch

cython: Add #+suffix-LL annotation

Signed-off-by: Michael Büsch's avatarMichael Buesch <m@bues.ch>
parent d7d6f688
......@@ -29,6 +29,7 @@ In order to support both compiling the Awlsim core with Cython and running the s
* `#+likely` : Mark an `if` condition as being likely to evaluate to True. This annotation can only be used in lines with an `if` statement. It helps the C compiler to generate better machine code.
* `#+unlikely` : Mark an `if` condition as being unlikely to evaluate to True. This annotation can only be used in lines with an `if` statement. It helps the C compiler to generate better machine code.
* `#+suffix-u` : Add an `u` suffix to all decimal and hexadecimal immediates in the line.
* `#+suffix-LL` : Add an `L` suffix to all decimal and hexadecimal immediates in the line.
To disable code coverage tracing an additional special comment is provided:
......
......@@ -188,10 +188,15 @@ def pyCythonPatch(fromFile, toFile):
break
# Add an "u" suffix to decimal and hexadecimal numbers.
if "#+suffix-u" in line:
if "#+suffix-u" in line or "#+suffix-U" in line:
line = re.sub(r'\b([0-9]+)\b', r'\1u', line)
line = re.sub(r'\b(0x[0-9a-fA-F]+)\b', r'\1u', line)
# Add an "LL" suffix to decimal and hexadecimal numbers.
if "#+suffix-ll" in line or "#+suffix-LL" in line:
line = re.sub(r'\b(\-?[0-9]+)\b', r'\1LL', line)
line = re.sub(r'\b(0x[0-9a-fA-F]+)\b', r'\1LL', line)
# Comment all lines containing #@nocy
# or #@cyX for the not matching version.
if "#@nocy" in stripLine:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment