You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
955 B

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /***************************************************************************
  2. Copyright 2003 by Salvador Eduardo Tropea (SET)
  3. This file is covered by the GPL license.
  4. For more information read parttree.cc
  5. ***************************************************************************/
  6. #if defined(Uses_TVPartitionTree556) && !defined(TVPartitionTree556_Included)
  7. #define TVPartitionTree556_Included
  8. class TVPartitionTree556
  9. {
  10. public:
  11. TVPartitionTree556();
  12. ~TVPartitionTree556();
  13. void add(unsigned unicode, uint16 code);
  14. uint16 search(unsigned unicode);
  15. uint16 isearch(unsigned unicode);
  16. protected:
  17. uint16 ***base;
  18. #ifdef DEBUG
  19. int tables, blocks;
  20. #endif
  21. };
  22. // This is an inline version for code that really needs speed
  23. inline
  24. uint16 TVPartitionTree556::isearch(unsigned unicode)
  25. {
  26. uint16 **t=base[unicode>>11];
  27. if (!t) return 0xFFFF;
  28. uint16 *l=t[(unicode>>6) & 0x1F];
  29. if (!l) return 0xFFFF;
  30. return l[unicode & 0x3F];
  31. }
  32. #endif