diff options
author | charan makkina <charan795m@gmail.com> | 2019-04-30 17:40:53 +0530 |
---|---|---|
committer | charan makkina <charan795m@gmail.com> | 2019-05-20 18:14:40 +0530 |
commit | a826fe833d3f2a8fe2673fa05811fe1a22baf045 (patch) | |
tree | da11a17c46ca9b8a002a52a290628574fa3f5eda /stacks/lwip_stack/lwip_src/common/rb_tree.h | |
parent | 3e6bf7b64eea418c59959c18750261b815b2892c (diff) |
Feature: 19.04 part 1
Change-Id: Ibba924b8deca1f246b9dcb12d89d085b6fd33046
Signed-off-by: charan makkina <charan795m@gmail.com>
Diffstat (limited to 'stacks/lwip_stack/lwip_src/common/rb_tree.h')
-rw-r--r-- | stacks/lwip_stack/lwip_src/common/rb_tree.h | 112 |
1 files changed, 0 insertions, 112 deletions
diff --git a/stacks/lwip_stack/lwip_src/common/rb_tree.h b/stacks/lwip_stack/lwip_src/common/rb_tree.h deleted file mode 100644 index 87174fa..0000000 --- a/stacks/lwip_stack/lwip_src/common/rb_tree.h +++ /dev/null @@ -1,112 +0,0 @@ -/* -* -* Copyright (c) 2018 Huawei Technologies Co.,Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at: -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef _UNX_RBTREE_H -#define _UNX_RBTREE_H - -#ifdef __cplusplus -/* *INDENT-OFF* */ -extern "C" { -/* *INDENT-ON* */ -#endif -#include <stdint.h> -#include "types.h" -#include "common_pal_bitwide_adjust.h" - -#define rb_parent(a) ((struct rb_node *)((a)->rb_parent_color & ~3)) -#define rb_color(a) ((a)->rb_parent_color & 1) - -struct rb_node -{ - union - { - unsigned long rb_parent_color; - u64 rb_parent_color_a; - }; - -#define RB_RED 0 -#define RB_BLACK 1 - union - { - struct rb_node *rb_right; - u64 rb_right_a; - }; - - union - { - struct rb_node *rb_left; - u64 rb_left_a; - }; -}; - -#define rb_set_red(c) do { (c)->rb_parent_color &= ~1; } while (0) -#define rb_set_black(c) do { (c)->rb_parent_color |= 1; } while (0) - -/* The alignment might seem pointless, but allegedly CRIS needs it */ - -struct rb_root -{ - union - { - struct rb_node *rb_node; - u64 rb_node_a; - }; -}; - -#define rb_is_red(e) (!rb_color(e)) -#define rb_is_black(e) rb_color(e) - -static inline void -rb_set_color (struct rb_node *rb1, int color2) -{ - rb1->rb_parent_color = (rb1->rb_parent_color & ~1) | color2; -} - -static inline void -rb_set_parent (struct rb_node *rb1, struct rb_node *pa) -{ - rb1->rb_parent_color = (rb1->rb_parent_color & 3) | (unsigned long) pa; -} - -#define RB_ROOT (struct rb_root) { NULL, } - -extern void rb_erase (struct rb_node *, struct rb_root *); - -extern void rb_insert_color (struct rb_node *, struct rb_root *); - -extern struct rb_node *rb_next (const struct rb_node *); - -#define rb_entry(ptr, type, member) container_of(ptr, type, member) - -#define RB_EMPTY_ROOT(root1) ((root1)->rb_node == NULL) -#define RB_CLEAR_NODE(node2) (rb_set_parent(node2, node2)) -#define RB_EMPTY_NODE(node1) (rb_parent(node1) == node1) - -static inline void -rb_link_node (struct rb_node *node1, struct rb_node *parent1, - struct rb_node **rb_link1) -{ - node1->rb_left = node1->rb_right = NULL; - node1->rb_parent_color = (unsigned long) parent1; - *rb_link1 = node1; -} - -#ifdef __cplusplus -/* *INDENT-OFF* */ -} -/* *INDENT-ON* */ -#endif -#endif /* _UNX_RBTREE_H */ |