[aseek-devel] charset code

From: Gregory Kozlovsky (no email)
Date: Tue Mar 18 2003 - 12:45:28 EST


Hello, Kir,

Do you know, at least something about what the following code from
charset.cpp mean?
Is it some kind of hashing? Why is the assignement repeated twice?

void MakeWordRange(TCHARSET* charset)
{
    mdemset(charset->wordch, 0, sizeof(charset->wordch));
    unsigned char* pc = charset->chars;
    while (*pc)
    {
        charset->wordch[*pc >> 3] |= (1 << (*pc & 7));
        pc++;
    }
    pc = (unsigned char*)WORDCHAR;
    while (*pc)
    {
        charset->wordch[*pc >> 3] |= (1 << (*pc & 7));
        pc++;
    }
}

and

int WordChar(unsigned char s, int charset)
{
    return Charsets[charset].wordch[s >> 3] & (1 << (s & 7)) ? 1 : 0;
}

        Gregory Kozlovsky

Project Manager for Information Systems Tel: +41 (0)1 632 63
70
International Relations and Security Network (ISN) Fax: +41 (0)1 632 14
13
Center for Security Studies Email:

ETH Zürich (Swiss Federal Institute of Technology Zurich)
http://www.isn.ch/
Leonhardshalde 21, ETH-Zentrum / LEH
CH-8092 Zürich, Switzerland








Hosted Email Solutions

Invaluement Anti-Spam DNSBLs



Powered By FreeBSD   Powered By FreeBSD