X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=libcds%2Fsrc%2Fstatic_sequence%2Fwt_node_leaf.cpp;h=d99ea62291defad0d1a8bc0b3e909bf217ca711e;hb=a9846746dc7a55764591fcc273fd48c6049df962;hp=6f6c887aab9b172333629a9a4c57f5fcc734c365;hpb=0bf9688e2615a9fc07860c5762240e4ce26ee5d3;p=SXSI%2FXMLTree.git diff --git a/libcds/src/static_sequence/wt_node_leaf.cpp b/libcds/src/static_sequence/wt_node_leaf.cpp index 6f6c887..d99ea62 100644 --- a/libcds/src/static_sequence/wt_node_leaf.cpp +++ b/libcds/src/static_sequence/wt_node_leaf.cpp @@ -1,3 +1,23 @@ +/* wt_node_leaf.cpp + * Copyright (C) 2008, Francisco Claude, all rights reserved. + * + * wt_node_leaf + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ #include @@ -11,20 +31,18 @@ wt_node_leaf::wt_node_leaf() {} wt_node_leaf::~wt_node_leaf() {} uint wt_node_leaf::rank(uint symbol, uint pos, uint l, wt_coder * c) { - assert(symbol==this->symbol); + if(symbol!=this->symbol) return 0; pos++; - assert(pos<=count); return pos; } uint wt_node_leaf::select(uint symbol, uint pos, uint l, wt_coder * c) { - assert(symbol==this->symbol); - assert(pos<=count && pos>0); + if(symbol!=this->symbol) return (uint)-1; + if(pos==0 || pos>count) return (uint)-1; return pos; } uint wt_node_leaf::access(uint pos) { - assert(pos