why SkDescriptor don't check fLength

4 views
Skip to first unread message

黄世平

unread,
Sep 25, 2025, 1:21:07 PM (2 days ago) Sep 25
to skia-discuss
Source Code:
bool SkDescriptor::operator==(const SkDescriptor& other) const {
    // the first value we should look at is the checksum, so this loop
    // should terminate early if they descriptors are different.
    // NOTE: if we wrote a sentinel value at the end of each, we could
    //       remove the aa < stop test in the loop...
    const uint32_t* aa = (const uint32_t*)this;
    const uint32_t* bb = (const uint32_t*)&other;
    const uint32_t* stop = (const uint32_t*)((const char*)aa + fLength);
    do {
        if (*aa++ != *bb++)
            return false;
    } while (aa < stop);
    return true;
}

why not use if(this.flength != other.fLength)  return false;
Reply all
Reply to author
Forward
0 new messages