File: node.hh

package info (click to toggle)
ruby-unf-ext 0.0.6-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,128 kB
  • ctags: 147
  • sloc: cpp: 14,043; ruby: 79; makefile: 2
file content (25 lines) | stat: -rw-r--r-- 590 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#ifndef UNF_TRIE_NODE_HH
#define UNF_TRIE_NODE_HH

namespace UNF {
  namespace Trie {
    class Node {
    public:
      unsigned jump(unsigned char ch) const { return base() + ch; }
      unsigned value() const { return base(); }
      unsigned check_char() const { return data>>24; }
      unsigned to_uint() const { return data; }

      static const Node* from_uint_array(const unsigned* node_uints)
      { return reinterpret_cast<const Node*>(node_uints); }

    private:
      unsigned base() const { return data & 0xFFFFFF; }

    private:
      unsigned data;
    };
  }
}

#endif