gencode icon indicating copy to clipboard operation
gencode copied to clipboard

Question - why all the i+0 ?

Open zfLQ2qx2 opened this issue 5 years ago • 2 comments

One question - in the generated code I see many instances of i+0. I'm pretty sure that the compiler will optimize those out, but I'm curious why they are there.

zfLQ2qx2 avatar Jan 27 '19 07:01 zfLQ2qx2

@andyleap ^^

zfLQ2qx2 avatar Jan 29 '19 14:01 zfLQ2qx2

Fixed length fields are handled by incrementing the 0 portion, rather then having to increment the i. The generator only emits the i once it's been incremented, which means structs that are completely fixed size can be generated as nothing more then a series of byte operations, completely bypassing the need to mess with the index

andyleap avatar Jan 29 '19 15:01 andyleap