Cesium
Cesium copied to clipboard
More efficient constant conversion
From #157:
Current implementation is inefficient for constants. For example,
1 + 'b'
gives the following:IL_0000: ldc.i4 1 IL_0005: ldc.i4 98 IL_000a: conv.u1 IL_000b: conv.i4 IL_000c: add IL_000d: stloc V_0
As you see, the char is first converted from int to byte, and then back to int. This could be removed if we implement lowering to implicit casts - the cast expression would see that the operand is a constant and emit it immediately. But this would require a lot of refactoring. so I left it for another day.