Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Namespace Members | Data Fields | Globals | Examples

bmconst.h

Go to the documentation of this file.
00001 /*
00002 Copyright(c) 2002-2005 Anatoliy Kuznetsov(anatoliy_kuznetsov at yahoo.com)
00003 
00004 Permission is hereby granted, free of charge, to any person 
00005 obtaining a copy of this software and associated documentation 
00006 files (the "Software"), to deal in the Software without restriction, 
00007 including without limitation the rights to use, copy, modify, merge, 
00008 publish, distribute, sublicense, and/or sell copies of the Software, 
00009 and to permit persons to whom the Software is furnished to do so, 
00010 subject to the following conditions:
00011 
00012 The above copyright notice and this permission notice shall be included 
00013 in all copies or substantial portions of the Software.
00014 
00015 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
00016 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 
00017 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
00018 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
00019 DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 
00020 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 
00021 OTHER DEALINGS IN THE SOFTWARE.
00022 
00023 For more information please visit:  http://bmagic.sourceforge.net
00024 
00025 */
00026 
00027 #ifndef BMCONST__H__INCLUDED__
00028 #define BMCONST__H__INCLUDED__
00029 
00030 namespace bm
00031 {
00032 
00033 #if defined(_WIN32) || defined (_WIN64)
00034 
00035 typedef unsigned __int64 id64_t;
00036 
00037 #else
00038 
00039 typedef unsigned long long id64_t;
00040 
00041 #endif
00042 
00043 typedef unsigned int   id_t;
00044 typedef unsigned int   word_t;
00045 typedef unsigned short short_t;
00046 
00047 
00048 
00049 const unsigned id_max = 0xFFFFFFFF;
00050 
00051 // Data Block parameters
00052 
00053 const unsigned set_block_size  = 2048u;
00054 const unsigned set_block_shift = 16u;
00055 const unsigned set_block_mask  = 0xFFFFu;
00056 const unsigned set_blkblk_mask = 0xFFFFFFu;
00057 
00058 // Word parameters
00059 
00060 const unsigned set_word_shift = 5u;
00061 const unsigned set_word_mask  = 0x1Fu;
00062 
00063 
00064 // GAP related parameters.
00065 
00066 typedef unsigned short gap_word_t;
00067 
00068 const unsigned gap_max_buff_len = 1280;
00069 const unsigned gap_max_bits = 65536;
00070 const unsigned gap_equiv_len = 
00071    (sizeof(bm::word_t) * bm::set_block_size) / sizeof(gap_word_t);
00072 const unsigned gap_levels = 4;
00073 const unsigned gap_max_level = bm::gap_levels - 1;
00074 
00075 
00076 // Block Array parameters
00077 
00078 const unsigned set_array_size = 256u;
00079 const unsigned set_array_shift = 8u;
00080 const unsigned set_array_mask  = 0xFFu;
00081 const unsigned set_total_blocks = (bm::set_array_size * bm::set_array_size);
00082 
00083 const unsigned bits_in_block = bm::set_block_size * sizeof(bm::word_t) * 8;
00084 const unsigned bits_in_array = bm::bits_in_block * bm::set_array_size;
00085 
00086 
00087 #ifdef BM64OPT
00088 
00089 typedef id64_t  wordop_t;
00090 const id64_t    all_bits_mask = 0xffffffffffffffff;
00091 
00092 # define DECLARE_TEMP_BLOCK(x)  bm::id64_t x[bm::set_block_size / 2]; 
00093 const unsigned set_block_size_op  = bm::set_block_size / 2;
00094 
00095 
00096 #else
00097 
00098 typedef word_t wordop_t;
00099 const word_t all_bits_mask = 0xffffffff;
00100 
00101 # define DECLARE_TEMP_BLOCK(x)  unsigned x[bm::set_block_size]; 
00102 const unsigned set_block_size_op  = bm::set_block_size;
00103 
00104 #endif
00105 
00106 
00107 
00108 /*!
00109    @brief Block allocation strategies.
00110    @ingroup bvector
00111 */
00112 enum strategy
00113 {
00114     BM_BIT = 0, //!< No GAP compression strategy. All new blocks are bit blocks.
00115     BM_GAP = 1  //!< GAP compression is ON.
00116 };
00117 
00118 
00119 } // namespace
00120 
00121 #endif
00122 

Generated on Thu Apr 20 13:28:46 2006 for BitMagic by  doxygen 1.4.1