• Benno Schulenberg's avatar
    chars: probe for a valid UTF-8 starter byte, instead of overstepping · 09cabcad
    Benno Schulenberg authored
    Instead of always stepping back four bytes and then tentatively
    moving forward again (which is wasteful when most codes are just
    one or two bytes long), inspect the preceding bytes one by one
    and begin the move forward at the first valid starter byte.
    
    This reduces the backwards searching time by close to 40 percent.
    09cabcad
chars.c 17.8 KB