How does memchr() work under the hood?

后端 未结 5 1382
迷失自我
迷失自我 2020-12-31 07:59

Background: I\'m trying to create a pure D language implementation of functionality that\'s roughly equivalent to C\'s memchr but uses arrays and indices i

5条回答
  •  借酒劲吻你
    2020-12-31 08:45

    This implementation of memchr from newlib is one example of someone's optimizing memchr: it's reading and testing 4 bytes at a time (apart from memchr, other functions in the newlib library are here).

    Incidentally, most of the the source code for the MSVC run-time library is available, as an optional part of the MSVC installation (so, you could look at that).

提交回复
热议问题