Files
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

83 lines
2.8 KiB
C

/* List implementation of a partition of consecutive integers.
Copyright (C) 2000-2024 Free Software Foundation, Inc.
Contributed by CodeSourcery, LLC.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 51 Franklin Street - Fifth Floor,
Boston, MA 02110-1301, USA. */
/* This package implements a partition of consecutive integers. The
elements are partitioned into classes. Each class is represented
by one of its elements, the canonical element, which is chosen
arbitrarily from elements in the class. The principal operations
on a partition are FIND, which takes an element, determines its
class, and returns the canonical element for that class, and UNION,
which unites the two classes that contain two given elements into a
single class.
The list implementation used here provides constant-time finds. By
storing the size of each class with the class's canonical element,
it is able to perform unions over all the classes in the partition
in O (N log N) time. */
#ifndef _PARTITION_H
#define _PARTITION_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include "ansidecl.h"
#include <stdio.h>
struct partition_elem
{
/* The next element in this class. Elements in each class form a
circular list. */
struct partition_elem* next;
/* The canonical element that represents the class containing this
element. */
int class_element;
/* The number of elements in this class. Valid only if this is the
canonical element for its class. */
unsigned class_count;
};
typedef struct partition_def
{
/* The number of elements in this partition. */
int num_elements;
/* The elements in the partition. */
struct partition_elem elements[1];
} *partition;
extern partition partition_new (int);
extern void partition_delete (partition);
extern int partition_union (partition, int, int);
extern void partition_print (partition, FILE*);
/* Returns the canonical element corresponding to the class containing
ELEMENT__ in PARTITION__. */
#define partition_find(partition__, element__) \
((partition__)->elements[(element__)].class_element)
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* _PARTITION_H */