1 /* 2 * Copyright (C) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef FILLP_RB_TREE_H 17 #define FILLP_RB_TREE_H 18 #include "fillp_os.h" 19 20 #ifdef __cplusplus 21 extern "C" { 22 #endif 23 24 #define RB_RED 0 25 #define RB_BLACK 1 26 27 struct RbNode { 28 struct RbNode *rbParent; 29 struct RbNode *rbRight; 30 struct RbNode *rbLeft; 31 FILLP_UINT color; 32 33 #ifdef FILLP_64BIT_ALIGN 34 FILLP_UINT8 padd[4]; 35 #endif 36 }; 37 38 struct RbRoot { 39 struct RbNode *rbNode; 40 }; 41 42 void FillpRbInsertColor(struct RbNode *x, struct RbRoot *root); 43 void FillpRbErase(struct RbNode *xNode, struct RbRoot *root); 44 45 #ifdef __cplusplus 46 } 47 #endif 48 49 #endif /* FILLP_RB_TREE_H */