this repo has no description

Simplify small string creation

authored by bernsteinbear.com and committed by

Max Bernstein 293ea5f2 640e1024

+1 -1
+1 -1
compiler.py
··· 305 305 value = value_str.encode("utf-8") 306 306 length = len(value) 307 307 assert length < 8, "small string must be less than 8 bytes" 308 - value_int = int.from_bytes(value[::-1], "big") 308 + value_int = int.from_bytes(value, "little") 309 309 return f"(struct object*)(({hex(value_int)}ULL << kBitsPerByte) | ({length}ULL << kImmediateTagBits) | (uword)kSmallStringTag /* {value_str!r} */)" 310 310 311 311 def _emit_const(self, exp: Object) -> str: