STC icon indicating copy to clipboard operation
STC copied to clipboard

Change the `cco_state` to avoid errors.

Open ri-fumo opened this issue 8 months ago • 0 comments

On some older platforms, the bit width of int may only be 16 bit.

In this case, if write a large source file, the number of lines will easily exceed 65533, and an error may occur.

(int16)65534 == CCO_STATE_DONE (int16)65535 == CCO_STATE_FINALLY (int16)65536 == CCO_STATE_INIT

Bit fields can be used like following

typedef struct {
    int state: 2;
    unsigned int line: sizeof(int)*8 - 2;
} cco_state;

ri-fumo avatar Jun 11 '25 12:06 ri-fumo