You are reading a single comment by @FransM and its replies. Click here to read the full conversation.
  • I can't help you with the inline C but if your string is null terminated you do not need the len variable at all. Just use

    while (*data)
    

    and the if statement could be avoided by writing

    s = s + (*(data++)=='\n');
    

    This exploits that the boolean expression returns 0 or 1.
    Whether this is faster is to be benchmarked as it will depend on compiler and how the code is actually compiled.

About

Avatar for FransM @FransM started