view nasmbuild/nasm-2.13rc9/asm/directbl.c @ 10554:587a0a262d22

<moonythedwarf> ` cd nasmbuild; tar -xf nasm.tar.gz
author HackBot
date Thu, 30 Mar 2017 20:58:41 +0000
parents
children
line wrap: on
line source

/*
 * This file is generated from directiv.dat
 * by directiv.pl; do not edit.
 */

#include "compiler.h"
#include <string.h>
#include "nasm.h"
#include "hashtbl.h"
#include "directiv.h"

const char * const directives[30] =
{
    NULL,
    NULL,
    NULL,
    "absolute",
    "bits",
    "common",
    "cpu",
    "debug",
    "default",
    "extern",
    "float",
    "global",
    "list",
    "section",
    "segment",
    "warning",
    "sectalign",
    "pragma",
    "export",
    "group",
    "import",
    "library",
    "map",
    "module",
    "org",
    "osabi",
    "safeseh",
    "uppercase",
    "subsections_via_symbols",
    "no_dead_strip"
};

enum directives find_directive(const char *token)
{
#define UNUSED (65535/3)
    static const int16_t hash1[32] = {
        0,
        UNUSED,
        UNUSED,
        UNUSED,
        UNUSED,
        0,
        0,
        10,
        0,
        11,
        UNUSED,
        UNUSED,
        0,
        0,
        0,
        14,
        UNUSED,
        UNUSED,
        UNUSED,
        -9,
        UNUSED,
        24,
        18,
        3,
        -16,
        15,
        UNUSED,
        UNUSED,
        22,
        -19,
        15,
        -6,
    };
    static const int16_t hash2[32] = {
        0,
        UNUSED,
        UNUSED,
        UNUSED,
        0,
        0,
        6,
        0,
        21,
        2,
        0,
        30,
        0,
        0,
        3,
        UNUSED,
        UNUSED,
        UNUSED,
        8,
        23,
        9,
        10,
        UNUSED,
        26,
        UNUSED,
        UNUSED,
        1,
        5,
        UNUSED,
        UNUSED,
        -4,
        UNUSED,
    };
    uint32_t k1, k2;
    uint64_t crc;
    uint16_t ix;

    crc = crc64i(UINT64_C(0x076259c3e291c26c), token);
    k1 = (uint32_t)crc;
    k2 = (uint32_t)(crc >> 32);

    ix = hash1[k1 & 0x1f] + hash2[k2 & 0x1f];
    if (ix >= 27)
        return D_unknown;

    ix += 3;
    if (nasm_stricmp(token, directives[ix]))
        return D_unknown;

    return ix;
}