php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
sbst.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2018 Alexander Borisov
3 *
4 * Author: Alexander Borisov <borisov@lexbor.com>
5 */
6
7#ifndef LEXBOR_SBST_H
8#define LEXBOR_SBST_H
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
14#include <string.h>
15
16#include "lexbor/core/base.h"
17
18
19typedef struct {
21
23 unsigned char value_len;
24
25 unsigned short left;
26 unsigned short right;
27 unsigned short next;
28}
30
31
32/*
33 * Inline functions
34 */
38 const lxb_char_t key)
39{
40 while (root != strt) {
41 if (root->key == key) {
42 return root;
43 }
44 else if (key > root->key) {
45 root = &strt[root->right];
46 }
47 else {
48 root = &strt[root->left];
49 }
50 }
51
52 return NULL;
53}
54
55#ifdef __cplusplus
56} /* extern "C" */
57#endif
58
59#endif /* LEXBOR_SBST_H */
#define NULL
Definition gdcache.h:45
unsigned char key[REFLECTION_KEY_LEN]
lxb_inline const lexbor_sbst_entry_static_t * lexbor_sbst_entry_static_find(const lexbor_sbst_entry_static_t *strt, const lexbor_sbst_entry_static_t *root, const lxb_char_t key)
Definition sbst.h:36
Definition sbst.h:19
lxb_char_t key
Definition sbst.h:20
unsigned short left
Definition sbst.h:25
unsigned short next
Definition sbst.h:27
lxb_char_t value[6]
Definition sbst.h:22
unsigned short right
Definition sbst.h:26
unsigned char value_len
Definition sbst.h:23
#define lxb_inline
Definition types.h:21
unsigned char lxb_char_t
Definition types.h:27