예제 #1
0
파일: tag.c 프로젝트: ochaslot/Sigil-update
GumboTag gumbo_tagn_enum(const char* tagname, int length) {
    int position = perfhash((const unsigned char *)tagname, length);
    if (position >= 0 &&
            length == kGumboTagSizes[position] &&
            !case_memcmp(tagname, kGumboTagNames[position], length))
        return (GumboTag)position;
    return GUMBO_TAG_UNKNOWN;
}
예제 #2
0
bool
solve(TTile* tiles, TPlacement* p, int* start, int end)
{
    int i;
    int at;

    for(i = *start; i < end; i++){
        perfhash(i, p->fPermutation);
        at = -1;
        while(rotate(at, p->fRotation)){
            at = failed_at(tiles, p);
            if (at < 0){
                *start = i;
                return true;
            }
        }
        // may miss solution after solution.
    }
    *start = i;
    return false;
}