Databases

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
Home » Development Group »» Databases
  • intarray internals

    1 answers - 1182 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg

    May 06 12:46, Volkan YAZICI wrote:
    I'm reading through the source code of intarray contrib module. Despite
    being at the beginning, I've some questions to ask. I'd be so
    appreciated if anybody can help.
    Sorry, I forgot one:
    [4]
    In the inner_int_contains() function of _int_tool.c, there's a while
    loop like
    [Code assumes that arrays are sorted.]
    na = ARRNELEMS(a);
    nb = ARRNELEMS(b);
    da = ARRPTR(a);
    db = ARRPTR(b);
    i = j = n = 0;
    while (i < na && j < nb)
    if (da[i] < db[j])
    i++;
    else if (da[i] == db[j])
    {
    n++;
    i++;
    j++;
    }
    else
    j++;
    return (n == nb) ? TRUE : FALSE;
    AFAICS, last "j++" should be replaced with "return FALSE". Because, "n"
    cannot be equal to "nb" no more, if "j" gets incremented without
    incrementing "n" (remember "j < nb" in the "while" condition).
    Regards.
    (end of broadcast)
    TIP 1: if posting/reading through Usenet, please send an appropriate
    subscribe-nomail command to majordomo (AT) postgresql (DOT) org so that your
    message can get through to the mailing list cleanly

Re: intarray internals


max 4000 letters.
Your nickname that display:
In order to stop the spam: 8 + 7 =
SPONSORED
QUESTION

SPONSORED
EMSDN