"""Exhaustive bounds proof for the MASM sprite compositor's /255 substitutions.""" for value in range(65026): assert value // 255 == (value + 1 + (value >> 8)) >> 8 rounded = value + 128 assert (value + 127) // 255 == (rounded + (rounded >> 8)) >> 8 print("PASS: exact floor/rounded alpha math for all 65026 possible channel sums")