10 if (!lmmc_std_bool_is_valid(lhs) || !lmmc_std_bool_is_valid(rhs)) {
13 *out = lhs == rhs ? 1 : 0;
20 if (!lmmc_std_bool_is_valid(value)) {
23 *out = lmmc_std_hash_mix64(value ? UINT64_C(1) : UINT64_C(0));
29 return set && set->
size <= 2 && (set->
size == 0 || set->
data);
36 for (
size_t i = 0; i < set->
size; ++i) {
37 if (!lmmc_std_bool_is_valid(set->
data[i])) {
47 uint8_t key = value ? 1u : 0u;
48 for (
size_t i = 0; i < set->
size; ++i) {
49 if (set->
data[i] == key) {
return 1; }
72 if (!set || !lmmc_std_bool_is_valid(value)) {
75 if (lmmc_std_bool_set_contains_value(set, value)) {
return LMMC_STATUS_OK; }
77 set->
data[set->
size++] = value ? 1u : 0u;
87 status = lmmc_std_bool_set_alloc(count > 2 ? 2 : count, out);
89 for (
size_t i = 0; i < count; ++i) {
90 status = lmmc_std_bool_set_append_unique(out, values[i]);
117 status = lmmc_std_bool_set_require_valid(set);
119 *out = lmmc_std_bool_set_contains_value(set, value);
129 status = lmmc_std_bool_set_require_valid(lhs);
131 status = lmmc_std_bool_set_require_valid(rhs);
133 for (
size_t i = 0; i < lhs->
size; ++i) {
134 if (!lmmc_std_bool_set_contains_value(rhs, lhs->
data[i])) {
149 if (!out || (
const void*)out == (
const void*)lhs ||
150 (
const void*)out == (
const void*)rhs) {
153 status = lmmc_std_bool_set_require_valid(lhs);
155 status = lmmc_std_bool_set_require_valid(rhs);
157 return lmmc_std_bool_set_alloc(2, out);
164 lmmc_status_t status = lmmc_std_bool_set_binary_alloc(lhs, rhs, out);
166 for (
size_t i = 0; i < lhs->
size; ++i) {
167 status = lmmc_std_bool_set_append_unique(out, lhs->
data[i]);
172 for (
size_t i = 0; i < rhs->
size; ++i) {
173 status = lmmc_std_bool_set_append_unique(out, rhs->
data[i]);
188 lmmc_status_t status = lmmc_std_bool_set_binary_alloc(lhs, rhs, out);
190 for (
size_t i = 0; i < lhs->
size; ++i) {
191 if (lmmc_std_bool_set_contains_value(rhs, lhs->
data[i])) {
192 status = lmmc_std_bool_set_append_unique(out, lhs->
data[i]);
208 lmmc_status_t status = lmmc_std_bool_set_binary_alloc(lhs, rhs, out);
210 for (
size_t i = 0; i < lhs->
size; ++i) {
211 if (!lmmc_std_bool_set_contains_value(rhs, lhs->
data[i])) {
212 status = lmmc_std_bool_set_append_unique(out, lhs->
data[i]);
229 lmmc_status_t status = lmmc_std_bool_set_binary_alloc(lhs, rhs, out);
231 for (
size_t i = 0; i < lhs->
size; ++i) {
232 if (!lmmc_std_bool_set_contains_value(rhs, lhs->
data[i])) {
233 status = lmmc_std_bool_set_append_unique(out, lhs->
data[i]);
239 for (
size_t i = 0; i < rhs->
size; ++i) {
240 if (!lmmc_std_bool_set_contains_value(lhs, rhs->
data[i])) {
241 status = lmmc_std_bool_set_append_unique(out, rhs->
data[i]);
void * lmmc_memory_alloc_array(size_t count, size_t element_size)
void lmmc_memory_free(void *pointer)
Private recoverable allocator for persistent LMMC ownership.
lmmc_status_t
LMMC 库统一返回的状态码.
@ LMMC_STATUS_ALLOCATION_FAILED
@ LMMC_STATUS_INVALID_ARGUMENT
lmmc_status_t lmmc_std_bool_set_intersection(const lmmc_std_bool_set_t *lhs, const lmmc_std_bool_set_t *rhs, lmmc_std_bool_set_t *out)
lmmc_status_t lmmc_std_bool_set_contains(const lmmc_std_bool_set_t *set, int value, int *out)
lmmc_status_t lmmc_std_bool_set_make(const int *values, size_t count, lmmc_std_bool_set_t *out)
构造去重的 bool 集合。
lmmc_status_t lmmc_std_bool_set_symmetric_difference(const lmmc_std_bool_set_t *lhs, const lmmc_std_bool_set_t *rhs, lmmc_std_bool_set_t *out)
lmmc_status_t lmmc_std_bool_set_difference(const lmmc_std_bool_set_t *lhs, const lmmc_std_bool_set_t *rhs, lmmc_std_bool_set_t *out)
lmmc_status_t lmmc_std_bool_set_subset(const lmmc_std_bool_set_t *lhs, const lmmc_std_bool_set_t *rhs, int *out)
void lmmc_std_bool_set_destroy(lmmc_std_bool_set_t *set)
lmmc_status_t lmmc_std_bool_equal(int lhs, int rhs, int *out)
按 LSR 规范的表键语义比较 bool 值。
lmmc_status_t lmmc_std_bool_set_union(const lmmc_std_bool_set_t *lhs, const lmmc_std_bool_set_t *rhs, lmmc_std_bool_set_t *out)
lmmc_status_t lmmc_std_bool_hash(int value, uint64_t *out)
为 LSR 规范的表键计算 bool 哈希。