Functions

  • template <typename Word>
    Word repeat_byte (Word byte)

    Non-vector, implementations of functions that search for data by reading from

    memory word-by-word.

    Defined at line 81 of file ../../third_party/llvm-libc/src/src/string/string_length.h

  • template <typename Word>
    bool has_zeroes (Word block)

    The goal of this function is to take in a block of arbitrary size and return

    if it has any bytes equal to zero without branching. This is done by

    transforming the block such that zero bytes become non-zero and non-zero

    bytes become zero.

    The first transformation relies on the properties of carrying in arithmetic

    subtraction. Specifically, if 0x01 is subtracted from a byte that is 0x00,

    then the result for that byte must be equal to 0xff (or 0xfe if the next byte

    needs a carry as well).

    The next transformation is a simple mask. All zero bytes will have the high

    bit set after the subtraction, so each byte is masked with 0x80. This narrows

    the set of bytes that result in a non-zero value to only zero bytes and bytes

    with the high bit and any other bit set.

    The final transformation masks the result of the previous transformations

    with the inverse of the original byte. This means that any byte that had the

    high bit set will no longer have it set, narrowing the list of bytes which

    result in non-zero values to just the zero byte.

    Defined at line 108 of file ../../third_party/llvm-libc/src/src/string/string_length.h

  • size_t string_length (const char * src)

    Unsigned int is the default size for most processors, and on x86-64 it

    performs better than larger sizes when the src pointer can't be assumed to

    be aligned to a word boundary, so it's the size we use for reading the

    string a block at a time.

    Defined at line 121 of file ../../third_party/llvm-libc/src/src/string/string_length.h

  • void * find_first_character (const unsigned char * src, unsigned char ch, size_t max_strlen)

    Defined at line 142 of file ../../third_party/llvm-libc/src/src/string/string_length.h

  • void * find_first_character (const unsigned char * srcunsigned char chsize_t max_strlen)

    Defined at line 142 of file ../../third_party/llvm-libc/src/src/string/string_length.h