1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 20:07:36 +00:00

LibGfx: Do not use double negation in TIFFGenerator.py

No behavior change.
This commit is contained in:
Nico Weber 2023-12-23 11:36:55 -05:00 committed by Tim Flynn
parent c30911ab10
commit 80359517bd

View file

@ -192,10 +192,10 @@ def promote_type(t: TIFFType) -> TIFFType:
return t return t
def tiff_type_to_cpp(t: TIFFType, without_promotion: bool = False) -> str: def tiff_type_to_cpp(t: TIFFType, with_promotion: bool = True) -> str:
# To simplify the code generator and the Metadata class API, all u16 are promoted to u32 # To simplify the code generator and the Metadata class API, all u16 are promoted to u32
# Note that the Value<> type doesn't include u16 for this reason # Note that the Value<> type doesn't include u16 for this reason
if not without_promotion: if with_promotion:
t = promote_type(t) t = promote_type(t)
if t in [TIFFType.ASCII, TIFFType.UTF8]: if t in [TIFFType.ASCII, TIFFType.UTF8]:
return 'String' return 'String'
@ -232,7 +232,7 @@ struct TypePromoter<{}> {{
""" """
for t in TIFFType: for t in TIFFType:
if promote_type(t) != t: if promote_type(t) != t:
output += specialization_template.format(tiff_type_to_cpp(t, without_promotion=True), tiff_type_to_cpp(t)) output += specialization_template.format(tiff_type_to_cpp(t, with_promotion=False), tiff_type_to_cpp(t))
return output return output