struct State {
char buff[3];
CStringView view;
State() : view(buff) {}
};
{{ GENERATED_CODE }}
void evaluate(Context ctx) {
auto state = getState(ctx);
auto n = getValue<input_IN>(ctx);
// convert to an integer in range 0-99
uint8_t ndec =
(n < 0) ? 0 :
(n > 99) ? 99 :
(uint8_t)n;
// convert to characters, leave the last
// char intact as it always \x00
state->buff[0] = '0' + ndec / 10;
state->buff[1] = '0' + ndec % 10;
emitValue<output_OUT>(ctx, XString(&state->view));
}