Skip to content

[Optimize] Improve OGComparisonState API #133

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Sources/OpenGraph_SPI/Comparison/OGComparison.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@
#include "OGComparisonPrivate.h"

const void *OGComparisonStateGetDestination(OGComparisonState state) {
return state->destination;
return ((const OGComparisonStateStorage *)state)->destination;
}

const void *OGComparisonStateGetSource(OGComparisonState state) {
return state->source;
return ((const OGComparisonStateStorage *)state)->source;
}

OGFieldRange OGComparisonStateGetFieldRange(OGComparisonState state) {
return state->field_range;
return ((const OGComparisonStateStorage *)state)->field_range;
}

OGTypeID OGComparisonStateGetFieldType(OGComparisonState state) {
return state->field_type;
return ((const OGComparisonStateStorage *)state)->field_type;
}

bool OGCompareValues(const void *lhs, const void *rhs, OGTypeID type, OGComparisonOptions options) {
Expand Down
12 changes: 6 additions & 6 deletions Sources/OpenGraph_SPI/include/OGComparison.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,25 @@ OG_EXTERN_C_BEGIN
typedef struct OGFieldRange {
size_t offset;
size_t size;
} OGFieldRange;
} OGFieldRange OG_SWIFT_STRUCT OG_SWIFT_NAME(FieldRange);

typedef struct OGComparisonStateStorage *OGComparisonState;
typedef const void *OGComparisonState OG_SWIFT_STRUCT OG_SWIFT_NAME(ComparisonState);

OG_EXPORT
OG_REFINED_FOR_SWIFT
const void *OGComparisonStateGetDestination(OGComparisonState state);
const void *OGComparisonStateGetDestination(OGComparisonState state) OG_SWIFT_NAME(getter:OGComparisonState.destination(self:));

OG_EXPORT
OG_REFINED_FOR_SWIFT
const void *OGComparisonStateGetSource(OGComparisonState state);
const void *OGComparisonStateGetSource(OGComparisonState state) OG_SWIFT_NAME(getter:OGComparisonState.source(self:));

OG_EXPORT
OG_REFINED_FOR_SWIFT
OGFieldRange OGComparisonStateGetFieldRange(OGComparisonState state);
OGFieldRange OGComparisonStateGetFieldRange(OGComparisonState state) OG_SWIFT_NAME(getter:OGComparisonState.fieldRange(self:));

OG_EXPORT
OG_REFINED_FOR_SWIFT
OGTypeID OGComparisonStateGetFieldType(OGComparisonState state);
OGTypeID OGComparisonStateGetFieldType(OGComparisonState state) OG_SWIFT_NAME(getter:OGComparisonState.fieldType(self:));

typedef OG_ENUM(uint8_t, OGComparisonMode) {
OGComparisonModeBitwise = 0,
Expand Down
Loading