Skip to content

[Feature Request]: Provide a Clay_ElementIdEqual function. #548

@OetkenPurveyorOfCode

Description

@OetkenPurveyorOfCode

Due to padding in the Clay_String structure which is part of Clay_ElementId using memcmp to compare Clay_ElementIds is not possible.

I propose adding the following helper function to Clay:

bool Clay_ElementIdEqual(Clay_ElementId id1, Clay_ElementId id2) {
    return (id1.id == id2.id) 
    && (id1.baseId == id2.baseId) 
    && (id1.offset == id2.offset)
    && (id1.stringId.length == id2.stringId.length)
    && (memcmp(id1.stringId.chars, id2.stringId.chars, id1.stringId.length) == 0);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions