Alien-Judy

 view release on metacpan or  search on metacpan

src/judy-1.0.5/src/JudyCommon/JudyInsArray.c  view on Meta::CPAN

// Copyright (C) 2000 - 2002 Hewlett-Packard Company
//
// This program is free software; you can redistribute it and/or modify it
// under the term of the GNU Lesser General Public License as published by the
// Free Software Foundation; either version 2 of the License, or (at your
// option) any later version.
//
// This program 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 program; if not, write to the Free Software Foundation,
// Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
// _________________

// TBD:  It would probably be faster for the caller if the JudyL version took
// PIndex as an interleaved array of indexes and values rather than just
// indexes with a separate values array (PValue), especially considering
// indexes and values are copied here with for-loops anyway and not the
// equivalent of memcpy().  All code could be revised to simply count by two
// words for JudyL?  Supports "streaming" the data to/from disk better later?
// In which case get rid of JU_ERRNO_NULLPVALUE, no longer needed, and simplify
// the API to this code.
// _________________

// @(#) $Revision: 4.21 $ $Source: /judy/src/JudyCommon/JudyInsArray.c $
//
// Judy1SetArray() and JudyLInsArray() functions for Judy1 and JudyL.
// Compile with one of -DJUDY1 or -DJUDYL.

#if (! (defined(JUDY1) || defined(JUDYL)))
#error:  One of -DJUDY1 or -DJUDYL must be specified.
#endif

#ifdef JUDY1
#include "Judy1.h"
#else
#include "JudyL.h"
#endif

#include "JudyPrivate1L.h"

DBGCODE(extern void JudyCheckPop(Pvoid_t PArray);)


// IMMED AND LEAF SIZE AND BRANCH TYPE ARRAYS:
//
// These support fast and easy lookup by level.

static uint8_t immed_maxpop1[] = {
    0,
    cJU_IMMED1_MAXPOP1,
    cJU_IMMED2_MAXPOP1,
    cJU_IMMED3_MAXPOP1,
#ifdef JU_64BIT
    cJU_IMMED4_MAXPOP1,
    cJU_IMMED5_MAXPOP1,
    cJU_IMMED6_MAXPOP1,
    cJU_IMMED7_MAXPOP1,
#endif
    // note:  There are no IMMEDs for whole words.
};

static uint8_t leaf_maxpop1[] = {
    0,
#if (defined(JUDYL) || (! defined(JU_64BIT)))
    cJU_LEAF1_MAXPOP1,
#else
    0,                                  // 64-bit Judy1 has no Leaf1.
#endif
    cJU_LEAF2_MAXPOP1,
    cJU_LEAF3_MAXPOP1,
#ifdef JU_64BIT
    cJU_LEAF4_MAXPOP1,
    cJU_LEAF5_MAXPOP1,
    cJU_LEAF6_MAXPOP1,
    cJU_LEAF7_MAXPOP1,
#endif
    // note:  Root-level leaves are handled differently.
};

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.819 second using v1.00-cache-2.02-grep-82fe00e-cpan-dad7e4baca0 )